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

Geert Eltink:
Zend-Expressive Console CLI Commands
Feb 12, 2016 @ 11:21:15

In a new post to his site Geert Eltink shares how he added console command support to Zend Expressive, a PSR-7 framework from Zend that recently hit it's v1.0 mark.

zend-expressive does not come out of the box with a console for handling cli commands. However it's easy to add this and make full use of the container and its dependencies.

He uses the Symfony console component to handle most of the "heavy lifting" with the command line interaction, pulled in via Composer. He shows the process for getting the component installed and how to create the "bootstrap" file needed to build an instance of the Application class. He follows this with a simple "greeting" command including the configuration to add a few arguments and output the simple "Hello" message. He then creates the functionality to wire it in to the Zend Expressive application and gives an example of it in use.

tagged: zend expressive framework console command commandline cli tutorial symfony component

Link: https://xtreamwayz.com/blog/2016-02-07-zend-expressive-console-cli-commands

Symfony Finland:
What eZ Platform adds to Symfony
Feb 12, 2016 @ 10:44:01

On the Symfony Finland blog Jani Tarvainen has written up a new post sharing some of the things that eZ Platform adds to Symfony and what kind of functionality it brings with it on top of the usual Symfony featureset.

eZ Platform is a Content Management System built with the Symfony Full Stack framework. While this may be clear to developers who have worked with, it maybe somewhat vague for the unitiated, especially when compared with Concrete5 or Drupal, which have adopted Symfony components into their core. [...] The relationship between Symfony and eZ Platform is very similar to Expression Engine using Code Igniter or EPiServer using ASP.NET MVC.

He then goes on to talk about the things Symfony includes by default including the request/response structure, internationalization handling and Twig integration. From there he lists out the things that the eZ Platform adds on top of the standard Symfony including:

  • a content repository
  • dynamic routing
  • a user interface
  • user and permission management

He ends the post with a look at some of the other bundles and features eZ Platform also provides around HTTP caching, image manipulation and more.

tagged: ezplatform symfony project framework content management system

Link: https://www.symfony.fi/entry/what-ez-platform-adds-to-symfony

Laravel News:
Laravel: Up and Running Available for Preorder
Feb 10, 2016 @ 11:34:08

If you're interested in the Laravel framework and possibly using it for your upcoming projects but aren't sure where to start, you should consider checking out Matt Stauffer's upcoming O'Reilly book "Laravel: Up and Running". According to this post on the Laravel News site the book is now available for pre-order.

Matt Stauffer has been writing a new book on Laravel named Laravel: Up and Running: A Framework for Building Modern PHP Apps and it’s published by O’Reilly Media. [...] This first edition is 250 pages and will come in either paperback or ebook form, but this current preorder is only available in paperback. Based on Amazon the expected shipping date is August 25, 2016.

The book walks you through the creation of a Laravel application from start to finish. it's no meant as a reference but a "work book" to teach the foundations of the framework. It hopes to provide a single point where developers, especially those familiar with "C-family programming languages", will be able to get started quickly.

tagged: laravel upandrunning oreilly preorder book mattstauffer framework introduction

Link: https://laravel-news.com/2016/02/laravel-up-and-running-available-for-preorder/

Mark Scherer:
Developing CakePHP 3+ Plugins, it’s fun!
Feb 01, 2016 @ 12:08:04

Mark Scherer has a post to his site looking at developing CakePHP 3+ plugins, showing how it's much easier than it used to be with previous versions of the framework.

he days of CakePHP 2 plugins and how difficult it was to actually develop plugins are over. Back in the days (OK, I still have to do it once in a while), there was even an app required to test a plugin. Since you didn’t want to have a boilerplate app for each plugin, you usually worked in your actual app. So you had cross contamination from that messing up your tests and stuff. Really annoying.

[...] While most of the concrete examples are about plugin development for CakePHP 3, the main ideas apply to all library code you write. And if you are a developer for other frameworks, the same principles apply, only the concrete implementation might differ.

He starts with the "real story" behind his development of a plugin - a need to integrate hashid support into a CakePHP v3-based application. He uses his own library as an example (here on GitHub) and shares his thought and development process in its creation. He then shares a few helpful tips for the would-be plugin authors out there:

  • Thinking about what should be in core vs a plugin.
  • Try to follow coding and package principles.
  • Following the six package principles including common reuse, common closure and package coupling practices.
tagged: cakephp3 framework plugin example principles tips hashid

Link: http://www.dereuromark.de/2016/01/29/developing-cakephp-3-plugins-its-fun/

Matthew Weier O'Phinney:
Expressive 1.0 in the Wild!
Jan 29, 2016 @ 09:33:08

In a new post to his site Matthew Weier O'Phinney has announced the release of Expressive v1.0 from Zend. The Expressive framework is PSR-7 based with a heavy emphasis on middleware and the reuse of other components to make a basic framework structure.

A few hours ago, we pushed Expressive 1.0.

This is a huge milestone for the ZF3 initiative; I've even called it the cornerstone. It signals a huge shift in direction for the project, returning to its roots as a component library. Expressive itself, however, also signals the future of PHP applications we envision: composed of layered, single-purpose PSR-7 middleware.

He also links to this post on the Zend Framework blog with more information about the release including what's new in 1.0.0 (hint: not much) and what you can look forward to in the future from the framework. He mentions some of the other PSR-7 frameworks out in the PHP ecosystem right now and some of the reasoning behind the project being created in the first place. He also talks some about how it was started and some of the feedback/contributions they've received since then.

tagged: expressive zend release stable framework psr7 middleware component

Link: https://mwop.net/blog/2016-01-28-expressive-stable.html

Laravel News:
Laravel Release Process
Jan 21, 2016 @ 09:22:33

On the Laravel News site they've posted about the framework release schedule for the next few minor version releases and the support levels each will include.

At Laracon 2013 in Washington D.C., Taylor announced the first official release cycle for the framework. [...] By having an official release cycle, it allows us as end users to plan around when we need to perform upgrades and also the dev team a way of knowing what is coming and when. Since this announcement all new releases have followed this schedule.

He talks briefly about the 5.1 release of the framework and how it changed up the flow by adding long term support (two years for bugfixes, three for security). He then outlines the release schedule from the 5.1 LTS release out to 5.5, the next LTS release. This is only a guideline for now and could possibly change in the future but at least it gives an idea of the schedule of things to come.

tagged: laravel framework release process schedule longtermsupport version

Link: https://laravel-news.com/2016/01/laravel-release-process/

True Dependency Injection with Symfony Components
Jan 20, 2016 @ 10:37:39

On the Toptal.com blog there's a recent post about true dependency injection with Symfony between components in your application and only using the dependency injection container for its intended purpose.

Symfony2, a high performance PHP framework, uses Dependency Injection Container pattern where components provide a dependency injection interface for the DI-container. This allows each component to not care about other dependencies. [...] But this means DI-container can be used as a Service Locator.

[...] In this article we will try to build a Symfony2 application without implementing Service Locator pattern. We will follow one simple rule: only DI-container builder can know about DI-container.

They start off by talking about the structure of the dependency injection container and how it relates to the three main types: controller, method and property injections. He then starts in on creating the sample project and requiring only the Symfony DI, configuration and Yaml components. He then creates a ContainerBuilder class and sets up the HttpKernel functionality to pull the response from the container. He then makes a simple controller with a default action that just responds with text. With this working he updates it to pull in an input variable. He then makes updates to the application with changes to the route handing, templating (Twig), Doctrine (database) and tag handling.

tagged: dependency injection di symfony component framework router yaml container tutorial httpkernel

Link: http://www.toptal.com/symfony/true-dependency-injection-symfony-components

Getting Started With Laravel
Jan 20, 2016 @ 09:06:16

On the NetTuts.com site there's a tutorial posted helping you get started with Laravel, one of the more recently popular PHP frameworks.

Almost all CMS systems use it, including Joomla, Drupal and WordPress, and of course many frameworks like CakePHP use it as well. I arrived at Laravel in early 2014 and I was instantly hooked. It not only uses OOP, it requires it! I have to admit, this was a challenge, but I learned so much thanks to it, and it has made the code I write for other systems a lot better too!

In this article I’ll show you how to get started with Laravel by installing everything that’s needed to run the system, showing you how to use Laravel Homestead - a great virtual machine - and finally, how to install Laravel itself.

The tutorial starts with an introduction of what the framework is and briefly mentions some of its main advantages: standardization, elegance and speed. It then gets into the steps for installing Laravel and setting up a basic application:

  • Install Composer
  • Install Git
  • Install VirtualBox and Vagrant
  • Download the Box (Homestead)
  • Install the Homestead CLI
  • Configure Homestead
  • Launching the Vagrant Box

Don't worry, each of these steps comes with all the commands and config file changes you'll need to make. With the environment up and running they finish the article off with a Composer require command to install a Laravel application and how to test that it's up and running.

tagged: laravel framework gettingstarted introduction homestead environment tutorial

Link: http://code.tutsplus.com/tutorials/getting-started-with-laravel--cms-25386

SitePoint PHP Blog:
Can PHP Be Even Faster? Light-Speed with the Blink Framework
Jan 18, 2016 @ 09:20:27

The SitePoint PHP blog has a tutorial posted that looks at a framework that could "make PHP go even faster", the Blink framework.

Blink was built to improve high performance applications that consume a lot of server resources, and it uses the Swoole PHP extension to achieve this goal. As an example, we will build a Blink powered notejam for our demo.

First the tutorial walks you through the installation of the Swoole extension (they choose from PEAR but you can also install from GitHub). Next up they install the Blink framework with a new project and fire up the built-in server to ensure it's working correctly. With that up and running they show how to configure the framework/server and get into building the sample "notejam" application. They make use of Twig for templating the frontend and several Illuminate packages for the database, console and filesystem functionality.

The remainder of the post walks through the actual code for the application:

  • creating and using the "notes" table
  • working with routing
  • creating templates
  • working with user management

Finally, with this system in place they show how to have a user verify themselves and add a new note to their list.

tagged: blink framework fast swoole extension tutorial note application

Link: http://www.sitepoint.com/can-php-be-even-faster-light-speed-with-the-blink-framework/

Matt Stauffer:
The auth scaffold in Laravel 5.2
Jan 11, 2016 @ 10:06:29

Matt Stauffer has continued his series about some of the new features in the latest release of the Laravel framework (v5.2) with this post looking at the new auth scaffolding it makes available.

If you're like me, many of the applications you build in Laravel have a similar Saas-type framework: user signup, user login, password reset, public sales page, logged-in dashboard, logout route, and a base Bootstrap style for when you're just getting started.

Laravel used to have a scaffold for this out of the box. It disappeared recently, to my great chagrin, but it's now back as an Artisan command: make:auth.

He talks about what all the scaffolding builds out including templates, routes and controllers. He provides examples of some of the generated code and what the output of these simple templates looks like (including a basic Bootstrap layout).

tagged: laravel framework auth scaffold tutorial example login user template controller route

Link: https://mattstauffer.co/blog/the-auth-scaffold-in-laravel-5-2