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

StarTutorial:
Modern PHP Developer - PSR
Oct 02, 2018 @ 18:21:50

If you're new to PHP or are working to enhance your skills, chances are you've at least heard of the PHP-FIG and the several PSRs that it has released to help provide structure around common functionality. In this article from StarTutorial they walk you through some of the basics of the more widely adopted PSRs including PSR-0/PSR-4 and PSR-3/PSR-4.

Prior to PHP Standards Recommendation (PSR), there were no truly uniformed standards for writing PHP code. For instance, for coding style, some people preferred Zend Framework Coding Standard, and some liked PEAR Coding Standards, and still others chose to create their own naming conventions and coding style.

[...] At the time of this writing, there are six accepted PSRs: two of them are about autoloading, two of them are related to PHP coding style and the remaining are about interfaces. In this chapter, we will discuss each PSR briefly. The purpose of this chapter is to introduce you to the ideas of PSRs. For further details on each one, the respective link are provided.

The post then goes through each of the major PSRs, describing them and providing code examples where relevant:

  • PSR-0 & PSR-4 for autoloading
  • PSR-1 & PSR-2 for coding standards
  • PSR-3 for logging interfaces
  • PSR-7 for HTTP message stricture

The post finishes with links to each of the PSRs on the PHP-GIF site for more information.

tagged: psr example psr0 psr4 psr3 psr2 psr1 psr7 tutorial phpfig

Link: https://www.startutorial.com/articles/view/modern-php-developer-psr

Community News:
PHP-FIG PSR Update
Mar 16, 2018 @ 16:57:45

The PHP-FIG group, the ones responsible for the standards that helped to make Composer a real possibility (PSR-0 and PSR-4) have posted a general update of the various PSRs that are currently in progress and a brief summary of the status on each.

Hello everyone, we (the secretaries) decided it was time to post a status update for the PSR which are pending, as a way to update you members and the whole community on our work, and also to start discussion around some PSR that need a little more participation.

Current PSRs in the list include:

  • PSR-5: PHP docblock recommendations
  • PSR-12: Coding style guidelines
  • PSR-17: HTTP factories
  • PST-19: Streams/Async processing

If you would like to participate in the working group for any of the items listed in the full post, reply to it and the group will get back with you shortly.

tagged: phpfig psr update list status

Link: https://groups.google.com/forum/?fromgroups=#!topic/php-fig/ywaSYo_tXdc

Matthew Weier O'Phinney:
PSR-15
Jan 24, 2018 @ 16:43:53

In a new post to his site Matthew Weier O'Phinney, lead developer on Zend Framework and representative in the PHP-FIG, covers the acceptance of PSR-15 by the group. PSR-15 relates to the creation of server request handlers and middleware that can use PSR-7 formatted messages.

Yesterday, following a unanimous vote from its Core Committee, PHP-FIG formally accepted the proposed PSR-15, HTTP Server Handlers standard.

This new standard defines interfaces for request handlers and middleware. These have enormous potential impact on the PHP ecosystem, as they provide standard mechanisms for writing HTTP-facing, server-side applications. Essentially, they pave the way for developers to create re-usable web components that will work in any application that works with PSR-15 middleware or request handlers!

He starts with a bit of background around the initial idea of the standard and some of the discussions that came up around it. The initial draft of the standard was modified to more correctly handle issues around response modification and the use of "handlers" for request/response manipulation. He then covers the final version of the standard, defined in the standard's documentation and enforceable via the psr/server-handler interface. Finally he covers how to use this to create re-usable middleware and an example using Expressive.

tagged: phpfig psr15 standard request response middleware handler

Link: https://mwop.net/blog/2018-01-23-psr-15.html

Michael Cullum:
A month of PHP FIG #1: October 2017
Nov 03, 2017 @ 15:52:47

Michael Cullum has posted the October 2017 edition of what has been happening in the PHP-FIG group for the month over on Medium.com.

As part of the effort to communicate better what’s going on within the PHP FIG we’re starting a new series of ‘A month of PHP FIG’ articles to be released towards the end of each month, each being a 2 minute read or less.

Topics mentioned in this month's edition include:

  • PSR-12 being formally re-introduced into the draft stage
  • a start of the voting for the secretary elections for two secretary posts
  • a discussion as to whether or not new PSRs should require PHP 7 or PHP 5 still
  • an agreement that PSR-18 will not cater to async http client requests due to the lack of a Promise PSR standard

There were also several new PSR ideas proposed including ones for internationalization, cache tagging and deprecation handling. You can read the full post here

tagged: phpfig monthly article october2017 psr

Link: https://medium.com/php-fig/a-month-of-php-fig-1-october-2017-af253682ef5b

Dotkernel.com:
What is PSR-7 and How to Use It
May 22, 2017 @ 15:18:50

On of the standards that have come out of the PHP-FIG (PHP Framework Interoperability Group) in the past few years has been PSR-7, a standards definition for working with HTTP requests and responses as PHP objects. While those that have worked with most of the PHP frameworks out there may be familiar with the concept, it can be confusing if you're just getting started with the idea. In this post on the Dotkernel site they introduce PSR-7, talking about its goals and what it defines to help bring everyone on the same page for HTTP requests.

PSR-7 is a set of common interfaces defined by PHP Framework Interop Group. These interfaces are representing HTTP messages, and URIs for use when communicating trough HTTP.

Any web application using this set of interfaces is a PSR-7 application.

They start off by defining (and linking to) the different interfaces involved in the PSR-7 specification (the spec doesn't define functionality, only the structure). From there the tutorial uses the Zend Diactoros component to illustrate an implementation of the PSR-7 structure. They cover two of the main tasks when working with HTTP requests/responses: working with the headers and fetching/writing to the body.

tagged: psr7 phpfig standard http request response introduction

Link: https://www.dotkernel.com/dotkernel3/what-is-psr-7-and-how-to-use-it/

CloudWays Blog:
Phil Sturgeon Talks About API Development, PHP-FIG, PHP Books And The Future Of PHP
Apr 25, 2017 @ 17:34:44

On the Cloudways blog there's a new post sharing an interview with Phil Sturgeon with some of his thoughts about API development, the PHP-FIG organization, PHP-related books and the future of the language.

Today we are super excited to have Phil Sturgeon with us for this interview. Phil is a cool dude and an experienced API dev. He has a lot of experience in creating API for different platforms. Right now, he is working at WeWork as a Platform Engineer. He has written an excellent book on creating API, “Build APIs You Won’t Hate”. He has worked with popular PHP tools and frameworks including CodeIgniter, FuelPHP, PyroCMS. Phil also contributed to PHP The Right Way and PHP-FIG.

Phil also speaks at PHP conferences and often mentors budding developers. In this Interview he talks about his development experiences, workflows and experience with API development.

In the interview Phil answers questions about:

  • how he got started in PHP development
  • his opinions on PHP 7.x
  • preferred development workflows
  • his (previous) involvement with the PHP-FIG
  • his speaking and the topics he usually covers

Check out the full interview for answers to these and other questions.

tagged: cloudways interview philsturgeon development api phpfig books language

Link: https://www.cloudways.com/blog/phil-sturgeon-php-interview/

PHP Town Hall Podcast:
Episode 50: Low down on PSR-15
Jan 11, 2017 @ 19:14:07

The PHP Town Hall podcast has returned with a new episode that gives you the low down on PSR-15, a proposal being discussed by the PHP-FIG group to provide structure around middleware implementation.

An all star cast this episode, as Ben and Phil are joined by regular guest Anthony Ferrara - thinker of good ideas and long-time part-time side-line contributor to the PHP-FIG, Woody Gilk - one-speed rider & BDFL of Kohana, and Beau Simensen - author of a bunch of stuff including StackPHP.

Here we’re talking about some awesome stuff the PHP-FIG is working on: PSR-15 (HTTP Middleware). [...] We discuss all this, and the reason PSR-7 (HTTP Message) is not enough for the ecosystem to benefit from shareable middleware.

You can catch this latest episode in a few different ways including the use of the in-page audio or video player, by downloading the mp3 directly or you can view the recording of the live Google Hangout over on YouTube. If you enjoy the episode be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.

tagged: phptownhall ep50 psr15 phpfig middleware anthonyferrara woodygilk beausimensen

Link: https://phptownhall.com/episode-50-low-down-on-psr15/

Voices of the ElePHPant:
Interview with Larry Garfield (#2)
Oct 25, 2016 @ 15:49:10

The Voices of the ElePHPant has posted their latest interview with a member of the PHP community. In this latest show host Cal Evans interviews Larry Garfield, a well-known developer and member of the Drupal community.

Cal and Larry talk about Larry's work on the PHP-FIG overhaul (PHP-FIG v3), how it changes the structure of the group and how it effects its members. He talks about the "member projects", the "core community" and what's changing in the workflow related to these two groups. He also explains the new workflows the group's work will follow and the move of the group to include a wider focus on the entire PHP community ecosystem. They also talk about Larry's work at Platform.sh and what kind of services they offer.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 of the show directly. If you enjoy the interview, be sure to subscribe to their feed and follow them on Twiiter when new episodes are released.

tagged: voicesoftheelephpant community interview larrygarfield podcast phpfig

Link: https://voicesoftheelephpant.com/2016/10/25/interview-larry-garfield/

SitePoint PHP Blog:
From HTTP Messages to PSR-7: What’s It All About?
Oct 06, 2016 @ 16:57:03

The SitePoint PHP blog has a new tutorial posted hoping to demystify some of the confusion around HTTP and PSR-7, a standard from the PHP-FIG group around the handling of request and response messages in PHP applications.

The PHP Framework Interoperability Group (PHP-FIG) has relatively recently approved another proposal, the PSR-7: HTTP Messages Interface. The document crystallizes HTTP messages into 7 interfaces which a PHP library should implement if they subscribe to the specification. In PSR-7 By Example, Matthew Weier O’Phinney, editor of the PSR, gives an interesting overview of the specification. So what is it?

They start with the HTTP side of things, briefly covering what HTTP messages are and the format they're transmitted in. Using some example curl requests they show requests and responses involving normal responses, redirects and how they're broken down into objects implementing the MessageInterface, RequestInterface and ResponseInterface. They outline the PSR-7 specification in a UML diagram and talk about some of the challenges associated with PSR-7's handling (including the use of immutable objects and how it fits in with middleware handling).

The post ends with a listing of a few of the frameworks/libraries that already make use of the PSR-7 structure including Symfony, Slim, Guzzle and the HTTPlug client.

tagged: psr7 http messages tutorial introduction phpfig standard

Link: https://www.sitepoint.com/from-http-messages-to-psr-7-whats-it-all-about/

SitePoint PHP Blog:
PHP-FIG Alternatives: The Pros and Cons of Various Visions
Sep 22, 2016 @ 16:10:49

On the SitePoint PHP blog paul Jones has written up some of his own perspective on the PHP-FIG and the work that's currently being done by the group on restructuring to make the group more effective, learning from past issues.

In his article The Past, Present and Future of the PHP-FIG, Larry Garfield gives a whirlwind tour of his impressions of the FIG, from its founding to one of its possible futures. I encourage you to read it in its entirety before continuing.

Herein, I will attempt to address some of the errors and omissions in Larry’s article, and offer two other possible futures for the FIG.

He starts by talking about the largest change the group is working on - the PHP-FIG 3.0 proposal. He compares the vision of this effort to some of the founding goals and principles of the group as documented in various emails and posts from current (and past) members of the group. Paul also talks about the FIG 2.0 workflow, what PSRs were before/after it was introduced and some of the overall impact that these and other PSRs from the group have had on the wider community.

He wraps up the post with a look at two alternatives he's proposing for the group's consideration as a way forward and an alternative to the PHP-FIG v3: independent interop groups and disbanding the PHP-FIG all together.

tagged: phpfig alternative vision opinion history group psr community

Link: https://www.sitepoint.com/php-fig-alternatives-the-pros-and-cons-of-various-visions/


Trending Topics: