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

SitePoint PHP Blog:
Practical OOP Building a Quiz App - Bootstrapping
November 14, 2014 @ 13:44:09

The SitePoint PHP blog has kicked off a new series of posts today with the first tutorial about building an application with OOP and the Slim framework. In this starting article they focus in on bootstrapping the application and introducing some of the basics behind MVC and OOP.

At a certain point of my development as a PHP programmer, I was building MVC applications by-the-book, without understanding the ins-and-outs. I did what I was told: fat model, thin controller. Don't put logic in your views. What I didn't understand was how to create a cohesive application structure that allowed me to express my business ideas as maintainable code, nor did I understand how to really separate my concerns into tight layers without leaking low-level logic into higher layers. I'd heard about SOLID principles, but applying them to a web app was a mystery. In this series, we'll build a quiz application using these concepts. We'll separate the application into layers, allowing us to substitute components: for example, it'll be a breeze to switch from MongoDB to MySQL, or from a web interface to a command-line interface.

They start off with a bit about why "MVC is not enough" and how they'll be applying domain modeling as a part of the application. There's also a brief mention of the concept of a service layer and how it will fit into the overall structure. Then it's on to the code: getting Slim installed (via Composer) and starting in on the interface/service classes for the Quiz. They walk you through entity creation for the Quiz and Question instances and a mapper to tie them together.

0 comments voice your opinion now!
practical oop tutorial series part1 bootstrap slimframework solid mvc

Link: http://www.sitepoint.com/practical-oop-building-quiz-app-bootstrapping/

Stanislav Malyshev:
unserialize() and being practical
November 04, 2014 @ 10:49:40

Stanislav Malyshev has a new post to his site talking about his proposal for a filtered unserialize change and why he sees it as a practical next step.

I have recently revived my "filtered unserialize()" RFC and I plan to put it to vote today. Before I do that, I'd like to outline the arguments on why I think it is a good thing and put it in a somewhat larger context. It is known that using unserialize() on outside data can lead to trouble unless you are very careful. Which in projects large enough usually means "always", since practically you rarely can predict all interactions amongst a million lines of code. So, what can we do?

He touches on three points that would make it difficult to just not use it this way (on external data) including the fact that there's not really any other way to work with serialized data in PHP. He suggests that by adding filtering to the unserialize handling of the language it can protect from issues around working with serialized external data.

Is this a security measure? [...] Yes, it does not provide perfect security, and yes, you should not rely only on that for security. Security, much like ogres and onions, has layers. So this is trying to provide one more layer - in case that is what you need.
0 comments voice your opinion now!
unserialize rfc filter practical security reasons

Link: https://php100.wordpress.com/2014/11/03/unserialize-and-being-practical/

SitePoint PHP Blog:
Book Review Practical Design Patterns in PHP
October 22, 2014 @ 12:17:12

The SitePoint PHP blog has posted a new book review from editor Bruno Skvorc about the "Practical Design Patterns in PHP" book from author Brandon Savage. The review talks both about some of Bruno's impressions of the content in the book and a bit about self-publishing too.

This review of Brandon Savage's Practical Design Patterns in PHP will include my own opinions and impressions about both the book, and the aspect of self-publishing. Many thanks to Brandon for giving me a review copy. "Design patterns are about common solutions to common problems. [...] They are concepts, not blueprints; ideas, not finished designs. [...] They add clarity to an otherwise difficult situation."

Bruno starts off with a look at the actual content of the book: its coverage of each of the patterns (17 in all), ones that he sees as missing and some of his "gripes" with the examples provided. He also talks about Brandon's choice around models being where primary functionality lives. He finishes the post talking about what he calls the "curse of knowledge" (for example, mentioning other advanced topics without knowing of the reader understands them) and the thoughts around self-publishing and some of the issues he has with it.

0 comments voice your opinion now!
bookreview book review designpatterns practical brandonsavage

Link: http://www.sitepoint.com/book-review-practical-design-patterns-php/

SitePoint PHP Blog:
Automate PHP with Phake - Real World Examples
July 10, 2014 @ 12:51:07

The SitePoint PHP blog has posted part two of their series looking at using Phake for automation in your applications. In this second part they take some of the basics they shared in part one and apply them in some more practical examples.

In part one, we covered the basics of Phake and demonstrated ways of executing tasks with it, covering groups, dependencies, and arguments. In this part, we'll look at some sample real world applications of Phake. Note that the following examples are largely based on things that I usually do manually that need some sort of automation.

He includes three different task examples, each with the code to make them happen (and descriptions of what it's doing):

  • Uploading Files to Server with a Phake task
  • Seeding the Database
  • Syncing Data

You can find out more about Phake on the project's GitHub page (including grouping, aborting and describing tasks).

0 comments voice your opinion now!
phake automate library tutorial part2 practical example

Link: http://www.sitepoint.com/automate-php-phake-real-world-examples/

SitePoint PHP Blog:
Becoming a PHP Professional Practical Teamwork
January 07, 2014 @ 13:35:12

In part four of his "Becoming a PHP Professional" post series Bruno Skvorc looks at the topic of "professional teamwork" , more so as it relates to a bit more practical things.

Last time, we discussed social aspects of teamwork, and how working in a team can both benefit and harm you. There's loads to take into consideration when working with other people, and lots to be gained. This time, let's talk about practical aspects of teamwork, particularly virtual teams or, in other words, teams with remote members.

He covers a three main topics (several that only relate to non-colocated teams):

  • Time Zone Difference and Broken Bottleneck in Teamwork
  • Organic Solutions (the importance of a technical lead and filter)
  • Inorganic solutions (technology to make life easier and remote workers more productive)
0 comments voice your opinion now!
professional developer series part3 practical teamwork solutions

Link: http://www.sitepoint.com/becoming-php-professional-practical-teamwork

Kevin Schroeder:
Google finally acknowledges that PHP exists
July 22, 2013 @ 11:53:10

Kevin Schroeder has an interesting post to his site about how Google is finally acknowledging PHP exists and how it's "exploding on Google App Engine"...but it's only happening just now.

How is it that one of the most despised programming languages in the word is running (as Google claims) up to 75% of the web? Many nay-sayers will say "oh it's just WordPress" or "oh, it's just PHPbb". But in doing that they are completely missing the point. [...] In the article Venture Beat says "PHP is moving to the Enterprise very quickly". This is not true. PHP IS in the enterprise and has been for a long time. People just either don't know it or refused to admit it.

He talks about the things that PHP does, including something interesting - it exposes the focus on the theoretical (the "ivory tower" as he puts it) and puts the focus back on the practical, real-life world of just getting things done. He suggests that Google's reasoning behind taking so long to get PHP up and running on the App Engine was just someone with "their blinders on" to the world of the practical that PHP fills so well.

0 comments voice your opinion now!
google appengine support exist enterprise theoretical practical

Link: http://www.eschrade.com/page/google-finally-acknowledges-that-php-exists

Blake Gardner:
Practical usage of PHP 5.5 generators yield keyword
June 24, 2013 @ 11:54:42

With the release of PHP 5.5 came a whole group of new features, including the "yield" keyword for better handling of values in iteration. Blake Gardner has posted a practical example of its use to his site today.

The key to understating the way the yield works verses a normal function is that rather than generating all of your data and returning the final array when it's done; you yield the value as it's generated. The state of the generator function is saved after you yield and then its state is restored when called again so the iteration can continue.

He shows a basic use of "yield" in a simple foreach of 1000000 values. In the first example, memory is exhausted and the second yields the values as they come, reducing the overhead significantly. The "range_yield" function returns them as the "for" loop generates them.

0 comments voice your opinion now!
yield feature practical use tutorial generator

Link: http://blakegardner.co/2013/06/24/practical-usage-of-php-5-5-generators-yield-keyword

PHPMaster.com:
Explore Aspect Oriented Programming with CodeIgniter, Part 2
August 20, 2012 @ 09:13:36

In this new post to PHPMaster.com they continue their look at aspect-oriented programming with CodeIgniter. In part one they introduced some of the fundamentals of AOP and in this new article, they dig deeper with more practical examples.

In the previous part of this series we learned what Aspect Oriented Programming (AOP) is and the meaning of important AOP terminology. In this part I'll explain why we need AOP using practical examples and how to add AOP behavior to your PHP application using the CodeIgniter framework.

They start with a look at a few pieces of functionality that could cut across multiple parts of the application like logging or authentication/authorization. They show how to use the "hooks" feature of CodeIgniter to implement the AOP proxy class generation, executing pre- and post-controller.

0 comments voice your opinion now!
aspectoriented programming tutorial codeigniter framework practical


DZone.com:
Practical Testing Patterns - Redux
June 02, 2011 @ 12:12:25

A while back we posted about a series of articles Giorgio Sironi was doing about some of the more practical applications of testing patterns in PHP unit testing. He' been building on the series ever since and has lots of great patterns you can use to more correctly structure your testing practices.

The current list includes:

There's lots more where these came from, all divided into sections like "Fixture Setup", "Test Double" and "Database Isolation" patterns. You can find the full list so far here.

0 comments voice your opinion now!
testing pattern unittest practical


Shameer's Blog:
PHP 5.3 Practical look into Lambda functions and closures
December 30, 2010 @ 11:11:26

For those out there still coming to grips with some of what PHP 5.3 has to offer, I'd suggest checking out this new article from Shameer about using lambdas and closures along with some examples putting them into action.

PHP 5.3 packaged the power of functional programming by adding support for lambda functions and closures. You will be familiar with them in javascript. In this article we will have a look into these features and its usages.

He starts with explanations of what they are with simple code examples showing their use - a lambda assigned to a variable and closures with the "use" keyword. He shows how they can be used in application prototyping, making handy callback functions and includes a practical example of finding the factorial of a number using a lambda.

2 comments voice your opinion now!
lambda closure tutorial practical example



Community Events





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


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

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