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

Zend Framework Blog:
Expressive 3.0.0RC1 is now ready!
Feb 28, 2018 @ 18:58:19

The Zend Framework blog has posted an announcement about the release of the latest Release Candidate for the next major step for their Expressive framework: Version 3.0.0RC1.

We've been working diligently the past three weeks to finalize API changes and new features for the Expressive 3.0 release, and are pleased to announce immediate availability of our first release candidate, 3.0.0rc1!

Why RC and not beta? [...] We feel at this point that we've identified and implemented all desired changes both in terms of API as well as features, and announced a feature freeze yesterday. This puts us in a status more analogous to release candidates than beta (where features could still be added).

The post then walks you through this new version and shows you how to get a new Expressive v3.0.0RC1 application set up or migrate an existing application to the new version. It then talks about some of the differences in the code and the ecosystem around the framrwork and finishes up with the roadmap and a look ahead.

tagged: expressive v3rc1 release zendframework zendexpressive tutorial

Link: https://framework.zend.com/blog/2018-02-27-expressive-3-rc1.html

Medium.com:
Expressive Code & Real Time Facades
May 10, 2017 @ 16:13:54

On his Medium.com blog Laravel project lead Taylor Otwell shares some of his thoughts on expressive code and real-time facades and how they make things simpler, event for testing/mocking.

Recently, I worked on some code that surfaced my most common use-case for Laravel 5.4’s “real-time” facades. If you’re not familiar with this feature, it allows you to use any of your application’s classes as a Laravel “facade” on-demand by prefixingFacades to the namespace when importing the class. This is not a feature that is littered throughout my code, but I find it occasionally provides a clean, testable approach to writing expressive object APIs.

To illustrate he uses the code from the Laravel Forge service talking about service providers (like DigitalOcean, Linode, etc) and "service" classes to contain API methods. He then shifts over to the controller to see how he'd like to access it, making a generic Provider class with a make method to create the instance. This has an issue, however, with testing making it very difficult. Instead he shifts over to the real-time facades and a factory where the test can more easily manually mock the method into a stub provider (example included).

tagged: expressive code realtime facade testing factory tutorial

Link: https://medium.com/@taylorotwell/expressive-code-real-time-facades-41c442914291

Zend Framework Blog:
Develop Expressive Applications Rapidly Using CLI Tooling
Apr 12, 2017 @ 14:54:05

On the Zend Framework blog Matthew Weier O'Phinney has posted a tutorial showing off some of the Expressive command line functionality that can help you rapidly develop applications using the Zend Expressive framework.

First impressions matter, particularly when you start using a new framework. As such, we're striving to improve your first tasks with Expressive. With the 2.0 release, we provided several migration tools, as well as tooling for creating, registering, and deregistering middleware modules. Each was shipped as a separate script, with little unification between them.

Today, we've pushed a unified script, expressive, which provides access to all the migration tooling, module tooling, and new tooling to help you create http-interop middleware. Our hope is to make your first few minutes with Expressive a bit easier, so you can start writing powerful applications.

The post starts with the Composer commands to create a new Expressive project and to pull in the "zendframework/zend-expressive-tooling" package to add the CLI tools to the project. It then talks briefly about what functionality the tools bring and helps you use them to create your first module, populating out the directories and files required. Next up is the creation of the middleware for a "list" action and what the resulting code ends up being. They end the post by pointing out that this is just a start to the ultimate functionality of this tool and are open to requests for new commands to add in future releases.

tagged: zendexpressive application tooling commandline expressive tutorial install

Link: https://framework.zend.com/blog/2017-04-11-expressive-tooling.html

Zend Framework Blog:
Error Handling in Expressive
Mar 24, 2017 @ 14:30:31

The Zend Framework blog has a new tutorial posted by Matthew Weier O'Phinney covering error handling techniques in Expressive with a few examples making use of some custom middleware and logic.

One of the big improvements in Expressive 2 is how error handling is approached. While the error handling documentation covers the feature in detail, more examples are never a bad thing!

In their example they're creating an API resource that returns a list of book details (ones the user has read). The goal is to use the existing error handling for everything except the custom exceptions they want to throw but keep with the JSON handling throughout. First the middleware to handling the API request is shown, complete with sorting and pagination. Then come the custom exception examples for invalid requests and server issues. These exceptions are then put into the Problem Details format with the help of another middleware. This then all tied together with the nested middleware handling Expressive provides and an example of the end result is included.

tagged: error handling expressive custom problemdetails tutorial json middleware

Link: https://framework.zend.com/blog/2017-03-23-expressive-error-handling.html

Zend Framework Blog:
Nested Middleware in Expressive
Mar 16, 2017 @ 16:52:21

On the Zend Framework blog Matthew Weier O'Phinney has posted another tutorial, this time showing you how to use nested middleware in Expressive allowing for the composition of your own workflow in the request/response flow.

A major reason to adopt a middleware architecture is the ability to create custom workflows for your application. Most traditional MVC architectures have a very specific workflow the request follows. While this is often customizable via event listeners, the events and general request lifecycle is the same for each and every resource the application serves.

With middleware, however, you can define your own workflow by composing middleware.

He starts by describing one of the main concepts in the workflow of the application: pipelines. He gives an example of the default pipeline included with the Expressive skeleton application and how the middleware it uses nests to create a custom logic and handling flow. He follows this with an example scenario showing how to add authentication into the pipeline, specifically the use of Digest authentication via a PSR7 middleware package. Code is included for the integration of this package and the end result - all pages requiring authentication. He shows how to modify this and limit it to only certain paths and how to nest them in the route definitions.

Finally he shows another approach - creating a custom middleware pipeline inside of the factory for the requested middleware. He also covers nested applications, using traits for common workflows and the use of "delegator factories".

tagged: expressive tutorial nested middleware pipeline custom authentication example

Link: https://framework.zend.com/blog/2017-03-15-nested-middleware-in-expressive.html

Matthew Weier O'Phinney:
Programmatic Expressive
May 17, 2016 @ 16:45:34

In this new post to his site Matthew Weier O'Phinney looks at a common misconception there seems to be for people using the Expressive framework from Zend - that their applications should be entirely configuration-driven.

Enrico just returned from phpDay, where he spoke about Expressive and the upcoming Zend Framework 3. One piece of feedback he brought back had to do with how people perceive they should be building Expressive applications: many think, based on our examples, that it's completely configuration driven!

As it turns out, this is far from the truth; we developed our API to mimic that of traditional microframeworks, and then built a configuration layer on top of that to allow making substitutions. However, it's not only possible, but quite fun, to mix and match the two ideas!

Matthew goes on to share an experiment he tried using his own code to "tweak" things away from being configuration-driven to a more programmatic approach. He shares a few tips to remember when trying the same with your application too. The post ends with an example of this migration and some of the benefits/issues that could come from the change.

tagged: programmatic expressive framework configuration migrate example

Link: https://mwop.net/blog/2016-05-16-programmatic-expressive.html

Geert Eltink:
Zend-Expressive Console CLI Commands
Feb 12, 2016 @ 17: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

Matthew Weier O'Phinney:
Expressive 1.0 in the Wild!
Jan 29, 2016 @ 15: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

Zend Developer Zone:
Announcing Expressive 1.0.0RC1!
Oct 22, 2015 @ 14:27:14

On the Zend Developer Zone Matthew Weier O'Phinney has posted an announcement about the release of the first Release Candidate for Expressive, version 1.0.0RC1. It builds on top of the zend-stratigility component of the Zend Framework.

Today, we are pleased to announce the immediate availability of the first release candidate of Expressive, a [PSR-7](http://www.php-fig.org/psr/psr-7/) [middleware](https://github.com/zendframework/zend-stratigility/blob/master/doc/book/middleware.md) microframework.

Expressive allows you to write PSR-7 middleware applications for the web. PSR-7 is a standard defining HTTP message interfaces; these are the incoming request and outgoing response for your application. By using PSR-7, we ensure that your applications will work in other PSR-7 contexts.

The post gives a brief introduction to the framework and lists some of its main features including:

  • customizable routing choice (select from several packages, not just forced into one)
  • implements the ContainerInterface for dependency injection handling
  • allows for the integration of several types of templating tools (Plates, Twig, etc)
  • customizable error handling (defaults to a template-based version)

He then walks you through getting started with the framework and creating a simple project. The setup prompts you and walks you through several choices of other packages to install (a router, a template library, etc) and hooks them all together. Once the installation is complete, all it takes is a simple web server start (PHP's own built-in works fine) and you'll have a fully functional application to work with. You can find out more information about the framework through the quickstart and full documentation.

tagged: expressive framework middleware psr7 releasecandidate rc1 announcement

Link: http://devzone.zend.com/6814/announcing-expressive-1-0-0rc1/

Alejandro Celaya:
My first approach to Zend Expressive
Sep 14, 2015 @ 15:50:40

The team behind the Zend Framework recently released a microframework of sorts that makes use of middleware as its primary location for processing: Zend Expressive. In this post to his site Alejandro Celaya takes a "first approach" to this new framework and shares some of what he's discovered.

One of the trending topics in the PHP world nowadays is the one about microframeworks. It started some years ago with Slim and Silex, but recently it has been an explossion of new microframeworks. First, Slim's team announced the third version of its own framework, which implemented the psr-7 HTTP standard by taking advantage of the middleware concept. [...] Then, Laravel launched the Lumen project, which is another microframework based on Laravel components [and] Zend framework's team launched Zend Expressive, which is similar to Slim 3 in the fact that it works with middleware and psr-7, built on top of zend-stratigility and zend-diactoros.

He starts the post off answering two "why" questions: "why microframeworks" and "why Zend Expressive". He then gets into the technical details, comparing some of the basic route handling across the different microframework projects (with code examples). He shows how Expression allows the use of a service container as the main object instead of just defining routes (and what routers that's compatible with). He briefly covers some of the other piece of the Expression puzzle: template library support, the service container, error management and some other considerations to think about with evaluating the tool.

tagged: zendexpressive expressive microframework introduction overview comparison

Link: http://blog.alejandrocelaya.com/2015/09/12/my-first-approach-to-zend-expressive/


Trending Topics: