2018-03-16 | By:Matthew Weier O'Phinney
Yesterday, we tagged and released Expressive 3!
Expressive 3 provides a middleware microframework.
Create a new Expressive application usingComposer:
$ composer create-project zendframework/zend-expressive-skeletonThe installer will prompt you for your choice of:
From there, it creates a new project for you, and allows you to get starteddeveloping immediately.
You can read morein our quick start,and may want tocheck out our command line toolingto see what we provide to make development even faster for you!
Expressive 3 embraces modern PHP, andrequires PHP 7.1 or higher. Strongtype-hinting, including return type hints, make both our job andyour jobeasier and more predictable. The ability to use all modern PHP features helps usdeliver a solid base foryour application.
Expressive 3 providesfull support for thePSR-15 (Middleware and RequestHandlers) standard. We believe stronglyin supporting standards, to the extent that this release alsodrops directsupport for the "double-pass" middleware stylewe have supported since version 1.0
Expressive 3 massively refactors its internals as well. In fact, the majority ofthe code in the zend-expressive package wasremoved, moved to other existingpackages where it had a better semantic affiliation1,or extracted to new packages2. This basepackage now mainly handles coordinating collaborators and providing auser-friendly interface to creating your application pipeline and routes.3
Expressive 3 provides more command line tooling and tooling improvements inorder to make developing your application easier. We added a command forcreating factories for existing classes (factory:create).4Themiddleware:create command now creates a factory for themiddleware generated. We added support for creating request handlers5,complete with factory generation and registration, as well as template support.6
Finally, we recognize that Expressive has changed massively between versions 1and 3, while simultaneously keeping its primary API stable and unchanged.However, to help users find the information they need for the version they run,we have rolled out versioned documentation, with each version providing onlyinformation specific to its release cycle:
The most recent version will always be present in the primary navigation, withlinks to other versions present as well.
We have several new components that provide features for Expressive — orany PSR-15 framework you may be using! These include:
zend-expressive-session,which provides session abstraction and middleware. We also provide a singleadapter, presently, that utilizes PHP's session extension,zend-expressive-session-ext.
zend-expressive-flashprovides flash message support, using zend-expressive-session.
zend-expressive-csrfprovides Cross Site Request Forgery protection, using zend-expressive-sessionand/or zend-expressive-flash.
zend-problem-detailsprovidesProblem Details responses foryour APIs, in both JSON and XML formats.
zend-expressive-halprovides tools for buildingHALresponse payloads for your API, in both JSON and XML formats.
We have a number of other packages in the works around authentication,authorization, and data validation that we will be releasing in the coming weeksand months; stay tuned for announcements!
We have prepared amigration documentthat covers new features, removed features, and a list of all changes.
Additionally, we have providedmigration toolingto aid you in your migration from version 2 to version 3.The tool will notnecessarily give you a fully running application, but itwill take care ofthe majority of the changes necessary to bump your application to version 3,including setting up appropriate dependencies, and updating your bootstrappingfiles to conform to the new skeleton application structure.
If you need assistance, you can find community help:
We have been working on a number of API-related modules for Expressive (and anyPSR-15 applications) since last summer, with a number of components alreadycompleted, and others close to completion. We plan to finalize these in the nextfew months.
We extend a hearty thank you to everyone who tested the various pre-releases andprovided feedback. Additionally, we are singling out the following individualswho provided significant contributions to the Expressive 3 project:
Enrico Zimuel provided a ton of feedback andcritique during the design phase, and was a driving force behind many of theAPI usability decisions.
Rob Allen did a workshop at SunshinePHP, right as wedropped our initial alpha releases, and provided feedback and testing for muchof our tooling additions.
Frank Brückner provided ongoing feedbackand review of pull requests, primarily around documentation; he is alsoresponsible for a forthcoming rewrite of our documentation theme to make itmore responsive and mobile-friendly.
Daniel Gimenes provided feedback and ideas aswe refactored zend-stratigility; he is the one behind package-level utilityfunctions such asZend\Stratigility\doublePassMiddleware(),Zend\Stratigility\path(), and more.
Witold Wasiczko provided the majority of therewrite of zend-stratigility for version 3. He can be celebrated for removingover half the code from that repository!
In addition to these people, I want to extend a personal thank you to thefollowing people:
Geert Eltink has helped maintain Expressive v2, andparticularly the various routers and template engines, making them ready forv3 and testing continually. As a maintainer, I was able to rely on him to takecare of merges as we finalized the releases, and was pleasantly surprised towake up to new releases several times when he fixed critical issues in ouralpha and RC releases.
Michał Bundyra provided a constant stream ofpull requests related to quality assurance (including ongoing work on our phpcsextension!), as well as critical review of incoming patches. He spearheadedimportant work in the refactoring process, including changes to how we handleresponse prototypes, and critical fixes in our routers to address issues withhow we detect allowed methods for path route matches. We synced each and everysingle day, often arguing, but always coming to consensus and plowing on.
If you get a chance, reach out to these contributors and thank them for therelease!
0: The Expressive ecosystem makesuse of many other standards as well, includingPSR-7 HTTP Messages,PSR-11 Container, andPSR-13 HTTP Links.
1: As an example, the routing,dispatch, and "implicit methods" middleware were all moved to thezend-expressive-routerpackage, as they each work with the router and route results.
2: Request generation, applicationdispatch, and response emission were all moved to a new package,zend-httphandlerrunner.
3: These refactors led to a netremoval of code across the board, vastly simplifying the internals. Thiswill lead to ease of maintenance, greater stability, and, based on benchmarkswe've been performing, 10% better performance and less system resource usage.
4:factory:create uses PHP'sReflection API in order to determine what dependencies are in place in order togenerate a factory class; it alsoregisters the class and factory with thecontainer!
5: In previous Expressive versions,we referred to "actions", which were any middleware that returned a responseinstead of delegating to another layer of the application. PSR-15 calls suchclassesrequest handlers. Our tooling provides anaction:create command,however, for those who prefer the "action" verbiage.
6: The command creates a templatenamed after the handler created; it uses the root namespace of the class todetermine where to put it in the filesystem. Additionally, it alters thegenerated request handler to render the template into a zend-diactorosHtmlResponse!
Subscribe to this blogvia RSS.
Endings and Beginnings: Goodbye, and Please Welcome the Laminas Project!
2020-01-24© 2006-2022 byZend byPerforce. Made with by awesomecontributors.
This website is built usingzend-expressive and it runs onPHP 7.