News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Anthony Ferrara:
Foundations Of OO Design
October 30, 2014 @ 09:36:24

In his newest post Anthony Ferrara looks at some of the things he calls the foundations of object-oriented design, as set of three things (and principles) to keep in mind when working on OOP applications.

It's quite easy to mix up terminology and talk about making "easy" systems and "simple" ones. But in reality, they are completely different measures, and how we design and architect systems will depend strongly on our goals. By differentiating Simple from Easy, Complex from Hard, we can start to talk about the tradeoffs that designs can give us. And we can then start making better designs.

He starts with the "simple vs easy" concept and how sometimes making the two meet can be difficult. He includes an example of interdependent interfaces and how they add complexity (and, in turn, make them less easy to use). He also talks about accidental versus essential complexity and how, sometimes, "accidental" isn't always a bad thing. Finally, he wraps it up with a few principles to remember in your development including recommendations to reduce (accidental) complexity and keeping the target developers in mind, making it easiest for them to use.

0 comments voice your opinion now!
foundation oop objectoriented design complex simple developer opinion

Link: http://blog.ircmaxell.com/2014/10/foundations-of-oo-design.html

Cal Evans:
The secret to writing a job post to attract PHP developers
August 18, 2014 @ 12:17:42

Cal Evans has posted another in his series looking at the right things to do when writing job posts and trying to attract developers for your company. In his previous posts he's talked about building a good team and getting the jobs page right. In his latest post he talks about a secret to writing the post itself: keeping it simple.

Is your company trying to hire a developer? Are you a recruiter responsible for helping your client hire a PHP developer? Do you have a job post out on the net? Get this one thing right and you'll find your PHP developer. Yes, that's the entire secret; keep it simple. Make it easy for us to scan, easy for us to understand, easy for us to figure out how to apply.

He includes a few points to follow to help guide you into the "keep it simple" approach including avoiding "semantically null terms" and listing the minimum skills for the job, not everything you could possibly need.

0 comments voice your opinion now!
jobpost attract developer secret simple

Link: http://blog.calevans.com/2014/08/15/the-secret-to-writing-a-job-post-to-attract-php-developers/

Master Zend Framework:
Create a Simple File Upload Form in Zend Framework 2
June 04, 2014 @ 11:51:06

On his "Master Zend Framework" site today Matthew Setter has a new tutorial showing you how to create a simple file upload through the forms handling in Zend Framework 2. The form will include three parts: an input filter, a form class and a controller action to request to show the resulting form.

Having trouble getting file uploads integrated into your forms in Zend Framework 2? Or are you just curious about how to do it, and you want a quick rundown? If either of these is you, come walk through today's post with me as I show you a simple example of how it's done - along with how to combine it with filters and validators. Before we get started, I could have composed the code in a much shorter form than have I've composed it. But my assumption is that you're likely using the full-stack framework.

He includes summaries describing each of the three parts of the setup and the code you'll need to create each. The validator checks for things like "too big", "too small" and the correct MIME type on the file given. The form itself only includes the file upload element with a description of "Attachment". The controller action creates the form instance and calls an "isValid" when the upload happens to execute the validation. He also throws in the view template to display the form itself.

0 comments voice your opinion now!
zendframework2 simple file upload tutorial form

Link: http://www.masterzendframework.com/forms-2/simple-file-upload-form

SitePoint Web Blog:
Is Ghost Really a WordPress Killer?
November 13, 2013 @ 11:19:32

The WordPress platform has become one of the de-facto standards when it comes to blogging and content management sites. In this new post, though, SitePoint wonders if a new competitor in the market is enough to unseat WordPress from its high ranking - Ghost.

When someone mentions the term blogging platform your mind likely brings up thoughts of WordPress, or maybe Blogger.com. It did, didn't it? While those two platforms have clearly carved out a respectable slice of the world's blogging population, there remains a void left unfilled. This gap in platforms was largely created by the incredible popularity and growth of the blogging world itself. [...] This new entrant goes by the stealthy moniker Ghost. A fitting name really, given it's unapologetic focus on no­frills web publishing.

They go through this new tool, spotlighting some of the features it offers and the extensibility it offers (complete with screenshots). While Ghost is a Node application (unlike its PHP counterpart) it's still relatively easy to get up and running. They do admit, however, that the title of the article is a bit inflammatory. Ghost and WordPress have different target audiences and widely different feature sets, but in the blogging realm, Ghost provides an interesting alternative.

0 comments voice your opinion now!
ghost wordpress blog overview tour simple

Link: http://www.sitepoint.com/ghost-really-wordpress-killer/

Rasmus Larsson:
Building a template engine in PHP
May 31, 2013 @ 11:11:27

Rasmus Larsson has a recent post to his site showing how to build a basic templating engine in PHP that uses the "__toString" to help render the result.

Possibly the most common sign of bad code is tight coupling, especially between logic and presentation. It might seem like a good idea to print out the HTML while the data is being generated, but it more often than not leads to a big incoherent mess of tangled code. [...] While PHP makes it unnecessarily easy to write shitty code it also provides a lot of ways to avoid it. I'll use this post to show you how ridiculously easy it is to create a template engine in PHP in three easy steps.

He includes the sample code for a "Template" class and shows the combination of exporting variables and output buffering to return the resulting template populated with values. The "__toString" method makes it so that you can just echo out the object and get the results.

0 comments voice your opinion now!
template engine tutorial simple tostring view

Link: http://www.rasmuslarsson.se/2013/05/a-template-engine-in-php

Lorna Mitchell:
Simplest PHP Generator Example
May 23, 2013 @ 10:31:02

On her blog Lorna Mitchell has posted an example of a basic generator written in PHP, a feature of the upcoming PHP version 5.5.

I really like the generators feature that's arriving in PHP 5.5, and since we're now into release candidate releases, it's actually not that far away. I've been speaking on this topic and I thought I'd share my trivially simple code example from my slides.

She includes an example of a very basic generator using the new "yield" keyword and how to implement it in a simple foreach loop. There's also a little talk about when is a good time to use generators in your applications (two examples: complex number calculation and working with large data sets a chunk at a time). For more information on how these generators will work, check out this page in the PHP manual.

0 comments voice your opinion now!
generator simple example introduction manual

Link: http://www.lornajane.net/posts/2013/simplest-php-generator-example

Rob Allen:
Simple logging of ZF2 exceptions
April 25, 2013 @ 10:31:40

In this new post to his site Rob Allen shows you how to implement a simple logging method for catching exceptions in your Zend Framework 2 application.

I recently had a problem with a ZF2 based website where users were reporting seeing the error page displayed, but I couldn't reproduce in testing. To find this problem I decided to log every exception to a file so I could then go back and work out what was happening. In a standard ZF2 application, the easiest way to do this is to add a listener to the 'dispatch.error' event and log using ZendLog.

He uses an event listener to attach a service that contains a "logException" method. This method uses the ZendLog component to write out the error message to a local log file including a backtrace of where the issue occurred.

0 comments voice your opinion now!
simple logging exception handling service event listener tutorial

Link: http://akrabat.com/zend-framework-2/simple-logging-of-zf2-exceptions

Vance Lucas:
Valitron The Simple Validation Library That Doesn't Suck
March 05, 2013 @ 11:43:24

Vance Lucas has created a "validation library that dosen't suck" and posted about it to his site - his Valitron library.

Valitron is a simple, minimal and elegant stand-alone PHP validation library with NO dependencies. Valitron uses simple, straightforward validation methods with a focus on readable and concise syntax.

He created the library because of frustration with other tools that had (sometimes major) dependencies on other packages. All he wanted was something lightweight and easy to use that was flexible about how it handled its validation rules. Valitron lets you apply a validation (like "required") against multiple fields in the provided data and includes checks for things like length, valid IP, active URL, alpha-numeric, date format and regular expression match. You can also add custom validation rules via a callback/closure.

0 comments voice your opinion now!
validation library valitron simple dependencies


Anthony Ferrara:
Designing An API Simplified Password Hashing
November 19, 2012 @ 12:42:22

A while back Anthony Ferrara proposed a standardized password hashing feature to be included into the core of PHP. It was voted on and it was decided it would be introduced in the PHP 5.5 releases. Anthony has written up a new post talking some about his process in making this upcoming feature and answering some of the most common questions he's gotten about it.

The other day, PHP 5.5 Alpha 1 was released to the public for the first round of testing the new features that are coming out. One of those new features is the Simplified Password Hashing API that I proposed (and was accepted). I have received a lot of feedback and criticism of the new API in the months since it's been committed. I figured now that Alpha 1 is out and people can play with it, I should respond to some of those items, and give a little bit more insight into why it was built the way it was...

He talks about some of his goals with the use of the functionality (simplicity, something "the 99%" can use) ans answers questions about:

  • Why the functions aren't namespaced
  • Why it's not just a class that can be included when needed
  • The choice of not going with an OOP interface
  • Why PBKDF2 and Crypt-SHA-512 aren't supported

...and several other questions, but you'll have to read the full post for the rest of those. You can find out a lot about the API for this functionality from its wiki page and, if you'd like to try it out (in an alpha state), you can download this version of PHP and compile it yourself.

0 comments voice your opinion now!
api design questions password hashing simple alpha


Chris Hartjes' Blog:
Simple API Testing Using Behat
February 27, 2012 @ 10:09:18

Chris Hartjes has taken some of his first steps to testing a web service with the help of the Behat BDD testing framework. In this new post he shares some of that knowledge and a bit of code to help guide you if you'd like to get started yourself.

I have been trying to push my JavaScript skills lately by first playing around with Node.js to get a feel for event-driven server-side coding and by trying to build something semi-useful using Knockout. [...] After working with PHPUnit's "assert that the result matches expectations" philosophy, switching to using a behavioural approach has changed how I decide to approach actually testing something.

He shows how to define a "scenario" in a more recognizable sort of English. His example is testing a web service to ensure of a few things:

  • the response is JSON
  • it contains at least one transaction
  • the first transaction has an ID, contains two teams and has a description

Included in the post is the resulting Behat test code (generated and modified with his testing details) and an example of the execution of the test.

I think that the BDD approach maps better to a results-oriented methodology when it comes to testing: you are using real-life scenarios to make sure that you are getting back the results you are expecting. In the end. that is still the goal of testing.
0 comments voice your opinion now!
simple api test behaviordriven behat example slim framework



Community Events





Don't see your event here?
Let us know!


language package composer library security introduction laravel opinion interview podcast install community tool symfony series version application framework release voicesoftheelephpant

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework