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

Zend Framework Blog:
Zend Framework 3 Update and Roadmap
Nov 26, 2015 @ 09:47:33

On the Zend Framework blog they've posted the roadmap and latest updates on the work being done for the next major version of the framework: Zend Framework 3.

In October, while at ZendCon, I presented a talk on Zend Framework 3 entitled "Components, PSR-7, and Middleware: Zend Framework 3." You can view it online, but this post discusses current status, details some decisions, and points to the work still to be done. It's a long read; grab a warm beverage, maybe some popcorn, and take your time.

They start by outlining some of the major concepts that ZF3 integrates and are key to how it will handle requests:

  • the component-based system it's built on, making major use of Composer-style packages and installation techniques
  • using the PSR-7 standard for handling of HTTP requests and responses
  • the use of middleware to modify the request/response and add logic

Finally, they get into the overall view and roadmap for the framework. They talk about the ServiceManager/EventManager, the role middleware plays in the request dispatching and the goal of reducing dependencies. The post ends with a look at the improvements they're striving for with new and better documentation and the next steps in the roadmap for the coming months.

tagged: zendframework3 roadmap update overview psr7 middleware component documentation

Link: http://framework.zend.com/blog/zend-framework-3-update-and-roadmap.html

Knp University:
Fun with Symfony's Console Component
Oct 06, 2015 @ 10:26:41

In a post to the Knp University blog they show you some of the fun you can have with the Symfony Console component in a single file including a few lesser known (and lesser used) features.

One of the best parts of using Symfony's Console component is all the output control you have to the CLI: colors, tables, progress bars etc. Usually, you create a command to do this. But what you may not know is that you can get to all this goodness in a single, flat PHP file.

They walk you through the creation of a ConsoleOutput object with a simple writeln output of a formatted method. They briefly mention the handling for changing up the output (OutputFormatter and OutputFormatterStyle) before getting into something a bit more complex - table layouts. They end the post with an interesting "hidden" feature inside the component, the Symfony track progress bar (animated gif included to show the end result).

tagged: symfony console component feature pretty output table track progressbar

Link: http://knpuniversity.com/blog/fun-with-symfonys-console

Symfony Finland Blog:
PHP and Symfony: Structure, Stability and Flexibility
Jul 03, 2015 @ 09:12:45

On the Symfony Finland blog they've posted a look at Symfony's past, present and future in terms of its structure and goals of stability and flexibility. This also includes some of the origins of PHP itself and how it evolved to the stage where creating framework made sense.

I like to think of modern PHP frameworks as glue to put together components to form something that is more than the sum of it's parts. [...] The Symfony Framework is a standard way (and framework code) to create applications using components. The application is always built with a specific structure, which allows code reuse of complete functionalities (Bundles in Symfony lingo) across projects. If you build using a collection of components, you'll need to invest time in learning how that software has decided to use the available components.

He talks more about the idea of components and how they make up a greater whole (like Symfony) and how they relate to the idea of "bundles". He then looks forward to the future of the framework, its long-term support and its work towards being fully PHP7 compatible.

The combination of the PHP language at 20 years and the Symfony framework at 10 years offers a stable platform with flexibility to adapt and grow in the future.
tagged: symfony framework past present future component bundle stability structure flexibility

Link: https://www.symfony.fi/entry/php-and-symfony-structure-stability-and-flexibility

Frank de Jonge:
Packages vs. Components: The Dependency Problem.
Jun 26, 2015 @ 11:12:18

In a new post to his site Frank de Jonge makes a distinction between packages versus components, pointing out that components are always packages but packages are not always components, and what it really boils down to is a problem of dependency.

The PHP landscape has fully transitioned into its Package Age™ [...] However, due to PHP's nature, there are some problems. While packages are great for re-use outside of frameworks, dependencies are still an issue. Namespaces resolve conflicts between classnames, but they do not offer a solution to package versioning. Especially in a framework-context, this can become very problematic. A real-world-example for this is Guzzle.

In his Guzzle example he describes the main problem - when packages restructure or make changes incompatible with prior versions and dependencies conflict and both must be installed. He also points out that, while this is bad for just packages, it can be made even worse working with components (his name for framework-based packages). Problems he mentions are the previously mentioned dependency conflicts but also some unexpected quirks with how Composer chooses to install packages. He gives an example of this second one with the installation of the Symfony EventDispatcher component and how, upon closer inspection, Composer seems to be installing two versions of the library at once.

tagged: package component dependency problem conflict versions guzzle eventdispatcher

Link: http://blog.frankdejonge.nl/packages-vs-components/

SitePoint PHP Blog:
4 Best Chart Generation Options with PHP Components
Jun 26, 2015 @ 08:30:29

The SitePoint PHP blog has a new article posted sharing four of the best charting libraries they've seen for use in your PHP applications. Options include both server and client side tools, making finding one for your situation easier.

Data is everywhere around us, but it is boring to deal with raw data alone. That’s where visualization comes into the picture. [...] So, if you are dealing with data and are not already using some kind of charting component, there is a good chance that you are going to need one soon. That’s the reason I decided to make a list of libraries that will make the task of visualizing data easier for you.

He starts with a brief comparison of the server side versus client side options, pointing out some high level advantages and disadvantages of each. He then gets into each of the libraries, giving an overview, an output example and some sample code to get you started:

  • Google Charts (Client Side)
  • FusionCharts (Client Side)
  • pChart (Server Side)
  • ChartLogix PHP Graphs (Server Side)

He ends with a wrapup of the options and links to two other possibilities you could also evaluate to find the best fit.

tagged: chart generation option component top4 list example output code

Link: http://www.sitepoint.com/4-best-chart-generation-options-php-components/

Symfony Blog:
New in Symfony 2.7
Apr 28, 2015 @ 10:13:14

The Symfony blog has been posted spotlights in several of the improvements in the 2.7 release of the framework over on their blog. Each of them describes the changes and includes some sample code showing the new feature in action:

Keep an eye on the Symfony blog for more of these component spotlights and improvements as they're released.

tagged: symfony blog new feature symfony2 version release component

Link: http://symfony.com/blog/

ServerGrove Blog:
Symfony2 components overview: OptionsResolver
Apr 23, 2015 @ 08:23:32

The ServerGrove blog has posted another in their spotlights on specific Symfony2 components. In this latest post they look at the OptionsResolver component.

In the 13th post of the Symfony2 components series we will be talking about one little but extremely useful component: OptionsResolver. This component helps us to reduce the boilerplate code required to create an options system with default parameters. As stated in the official docs, is array_replace on steroids.

They start with a common situation, wanting to use options from user input, but only if they exist, and otherwise provide a default. This includes the use of the array_replace function but with the OptionsResolver there's an even easier way. A simple example is included showing how to use it to define options (and throw an exception when an undefined one is set). They show how to use a closure to set defaults on a specific option with more complex logic and how to use the validation and normalization handling.

tagged: optionsresolver component symfony2 overview options

Link: http://blog.servergrove.com/2015/04/13/symfony2-components-overview-optionsresolver/

ServerGrove Blog:
Symfony2 components overview: Filesystem
Apr 22, 2015 @ 10:29:32

The ServerGrove blog has posted another in their series of Symfony2 component spotlights with a look at the Filesystem component.

The 15th post of the Symfony2 components series is focused on the Filesystem component, which provides some basic utilities to work with the filesystem. It extends PHP built-in functions such as mkdir() or copy() to make them more portable and easier to use and test.

They start by stating the common problems with working in the file system from PHP and the warnings/errors that can come with them. They show how this kind of thing can be prevented with the Filesystem component and the functionality it provides. They also list some of the other useful functions (besides mkdir and touch previous mentioned) including: chmod, rename, makePathRelative and mirror. They also briefly mention the file locking ability the component has to prevent issues with multiple services interacting with the same files.

tagged: symfony2 component overview filesystem introduction

Link: http://blog.servergrove.com/2015/04/22/symfony2-components-overview-filesystem/

Rob Allen:
Using ZendConfig with a Slim app
Apr 21, 2015 @ 09:11:31

Rob Allen has a quick post to his site continuing his theme of Slim framework-related posts with this new post showing how to use the ZendConfig module with a Slim application.

Sometimes you need more configuration flexibility for your application than a single array. In these situations, I use the ZendConfig component which I install via composer: composer require "zendframework/zend-config". This will install the ZendConfig component, along with its dependency ZendStdlib.

He shows how to use the glob function to have the component load a set of configuration files and the order they'd load in. He also points out that the ZendConfig component supports other formats including YAML and JSON data. He also includes a code example showing how you can load multiple formats at the same time (ex. some .php files and some .yml files with one call).

tagged: slim application zendframework2 config component zendconfig tutorial introduction

Link: http://akrabat.com/using-zendconfig-with-a-slim-application/

Hari KT:
Zend Feed and Guzzle
Apr 02, 2015 @ 10:43:06

Hari KT has posted some of the results of his work integrating the Guzzle client into the Zend Feed component for use in handling it's HTTP requests and responses.

You may have worked with Zend Feed as a standalone component. I don’t know whether you have integrated Zend framework Feed with Guzzle as Http Client. This post is inspired by Matthew Weier O’Phinney, who have mentioned the same on github.

He starts with the contents of his composer.json configuration file, pulling in Guzzle, ZendFeed and ZendService, and explaining the need for each. He then makes a simple "GuzzleClient" class and "GuzzleResponse" class that fit with the needed interfaces used by ZendFeed. Then he "wires them up" and injects the custom client and responses classes into the ZendFeed instance.

tagged: zendfeed component guzzle integrate http client interface tutorial

Link: http://harikt.com/blog/2015/04/01/zend-feed-and-guzzle/