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

Matt Stauffer:
How to set up your Laravel application for zero-downtime (Envoyer/Capistrano) deploys
Mar 30, 2017 @ 09:58:35

Matt Stauffer has a post to his site today sharing a step-by-step guide to setting up your Laravel application for zero downtime deploys when using the Envoyer/Capistrano combination.

The reason you're getting zero-downtime deploy from these tools is because the entire deploy process—clone, composer install, etc.—doesn't happen in the directory that is currently serving your site. Instead, each new release gets its own separate "release" directory, all while your site is still being served from its current "release" directory.

All of these release directories are just subdirectories of releases. Each directory here represents one of your deploys, and each directory individually has everything needed to serve your site. [...] So, once the build process is complete for each new release, your deploy tool will delete the current symlink and create a new current symlink that points to your latest release. Boom. Now that release is live.

He then relates this back to the deployment of a Laravel application with Envoyer which already follows this "symlink deploy" method. There's a few caveats he mentions with this deploy, however, including information that shouldn't be removed in each deploy (like caches or configuration files). He then provides the steps (commands) you can follow with the deploy to manually use the "symlink deploy" method in your own scripting.

tagged: laravel deployment envoyer capistrano manual symlink tutorial

Link: https://mattstauffer.co/blog/how-to-set-up-your-laravel-application-for-zero-downtime-envoyer-capistrano-deploys

SitePoint PHP Blog:
Contributing to PHP: How to Contribute to PHP's Manual
Apr 11, 2016 @ 12:11:41

On the SitePoint PHP blog there's a tutorial posted helping you get started editing and updating the PHP.net documentation, one of the most widely used parts of the PHP ecosystem.

In this two-part article series, we’ll be covering how to contribute to the PHP project. This will hopefully clarify what steps need to be taken for those looking to become more involved with PHP.

This first part will be covering how to contribute to PHP’s documentation, including how to request a php.net Account and what to do once an account has been granted.

He starts with a bit about why you should contribute back to the PHP project and how the documentation is a great place to start. He then gets into the structure of the documentation, the DocBook structure it uses and points to the online editor for the first time contributors. He includes a video showing how to use the system to resolve this bug showing an incorrect MongoDB Client example. For those that would rather do it locally, he shows how to setup and configure the source and required tools. He then shows the flow of updating the documentation, building the result and verifying the update looks correct.

Finally he talks about requesting a php.net account to push the changes back upstream and provides some general tips on things like style guidelines, page ordering and correctly versioning files.

tagged: contribute project manual tutorial online local edit

Link: http://www.sitepoint.com/how-to-contribute-to-phps-documentation/

SitePoint PHP Blog:
Drupal 8 Queue API – Powerful Manual and Cron Queueing
Dec 14, 2015 @ 11:54:38

On the SitePoint PHP blog Daniel Sipos has written up a tutorial spotlighting a powerful feature of Drupal 8, the latest major release of this popular project: the Queue API. Queueing in Drupal allows you to offload tasks to be handled outside of the current web request.

The Queue API in Drupal allows us to handle a number of tasks at a later stage. What this means is that we can place items into a queue which will run some time in the future and process each individual item at that point and at least once. Usually, this happens on CRON runs, and Drupal 8 allows for a quick set up for cronjob based queues. It doesn’t necessarily have to be CRON, however.

They use two examples to help illustrate how to use the queueing system: one that uses the cron-based approach and another that's more manually triggered. They start out with the theory behind it all, talking about the different pieces (objects/classes) and how they fit together to make the queueing system. With that out of the way the article starts in on the code and the "Node Publish" queue, defining its basic structure and hooking it in to the framework. It shows you how to create the cron worker to process the queue and how to build the manual worker to do the same but only when specifically called.

tagged: drupal8 queue manual cron process defer processing tutorial

Link: http://www.sitepoint.com/drupal-8-queue-api-powerful-manual-and-cron-queueing/

Sammy Powers:
Contributing to the PHP Manual
Jun 19, 2015 @ 13:23:27

If you've wanted to contribute something back to PHP but aren't familiar with C (or don't feel comfortable enough with it) Sammy Powers offers another solution. In his latest post he shows you how to contribute to the PHP documentation and update the manual for new features, missing information or fixes to current code examples.

If you've been wanting to contribute to PHP internals, starting with the documentation can be a great entry point; especially because it doesn't require dusting off those old C books from college. But knowing where to start can be tricky since information on how to contribute to the docs is scattered across the internet. This article is a step-by-step guide of how to contribute documentation to the PHP manual.

He starts with the "quick and dirty" way of editing the manual through the edit.php.net site, but points out that it's really only useful for smaller changes, not large documentation updates. The rest of the post shows you how to set up the documentation locally and generate the results to validate your changes. He talks some about the DocBook format they're written in, the build process with the PhD (PHP docs generator) and running the php.net test suite against the changes. This ensures that nothing else has broken on the site in the process.

He shows you where to make your changes, how to generate it from either a skeleton or using the docgen script and submitting the changes back to the repository. There's also a few other random changes to make before committing the files back via SVN and pushing them back upstream. He ends the post talking about the GoPHP7-ext project and how to find extensions that are missing documentation or where it's incomplete (easy thanks to an included "check-missing-docs" file included in the repository).

tagged: contribute documentation phpnet manual extension gophp7ext docgen tutorial

Link: https://www.sammyk.me/how-to-contribute-to-php-documentation

Hari KT:
Aura Framework V2: The Missing Manual
Jul 16, 2014 @ 10:14:52

Hari KT has a new post to his site today about a book he's been working around around the Aura framework that provides the missing manual for v2 of the project. He's publishing it as a book over on Leanpub too, so it's easy to grab...and for free too.

Aura has an awesome collection of libraries for different purpose. [...] If you are new to aura, there is probably something you may want to figure out yourself. Some of the components have version 1 and version 2 releases. There is a question of which branch corresponds to which version. [...] But people new to aura may be having hard time to find the specific documentation or may be stuck sometime. [...] I was talking with Paul M Jones regarding the documentation lately, and he too shared some concerns. Talking with him gave me some inspiration to start the missing manual for the aura framework.

The goal of the book it to provide a good resource for people to learn about the framework/components and their use and to help promote Aura. The book is available for free either on Github or Leanpub (or, to help support Hari and the project consider purchasing a copy).

tagged: aura framework component missing manual leanpub github

Link: http://harikt.com/blog/2014/07/15/aura-framework-v2-the-missing-manual/

Christian Weiske:
PHP manual viewers
Jan 31, 2014 @ 10:07:39

In this latest post to his site Christian Weiske shares three PHP manual viewers he finds useful (besides the actual PHP.net manual) and can be used offline.

The PHP documentation is really good. It covers almost all parts of the language and is filled with examples that help you grasp a function's meaning and usage really fast. And since PHP is a grown language, it's function naming and parameter order are often confusing - requiring you to look up the manual more often.

The three he suggests are:

  • pman - PHP manual pages
  • the xCHM version of the manual
  • Zeal, which also has support for lots of other docs from other languages/tools
tagged: manual viewer offline pman xchm zeal dash

Link: http://cweiske.de/tagebuch/php-man-viewer.htm

PHP Manual Masterpieces:
I Can't Spell PBKDF
Nov 13, 2013 @ 09:58:08

On the PHP Manual Masterpieces site has a recent post looking at PBKDF and PHP (and, more specifically, the information that's presented about it in the manual).

So why are we here? Well, a faithful follower slipped me a tip to check out the documentation. It turned out I agreed: I don’t like it. [...] Let’s be clear: I have read the backing C code of this feature and I see nothing wrong with the actual functionality. My issues are strictly with the documentation and the API, both of which are very PHP-ish in the sorts of ways that drive me to hateblog about a programming language on a Friday night. It turns out there are people who are totally okay with these design decisions, and I can’t help that their subjective tastes are wrong, but that’s just how it is.

She mentions three different major issues with the documentation currently in the manual:

  • Non-copypaste-safe cryptography
  • The fact that PHP does not fail effectively when it comes to cryptographic handling
  • The lack of units defined (like for the "length" parameter of hash_pbkdf2)
tagged: pbkdf cryptography manual examples error failure units

Link: http://phpmanualmasterpieces.tumblr.com/post/66426423275/i-cant-spell-pbkdf

PHP Manual Masterpieces:
PHP 2.0: A Review in Retrospect
Nov 01, 2013 @ 10:33:19

The "PHP Manual Masterpieces" site has varied a bit from its usual format and has gone with its own "blast from the past" doing a review in retrospect of PHP 2.0, a long forgotten version of the language with some "interesting" features.

This is not about PHP as we now know it in the waning months of 2013. This is about the waning months of the year 1997. I was nine years old. My life was not yet overshadowed by haphazard scripting languages. Somewhere in the wilderness, during a savage thunderstorm in the dead of night, a Danish Canadian pushed the 2.0 revision of his personal home page generator’s tarball to a web server.

The post looks at some of the "horrors" that made up PHP at that time including:

  • The footer PHP/FI added to every page
  • No real concept of input/output filtering
  • The use of register_globals
  • Weird handling of superglobal values
  • The inclusion of magic_quotes

And, of course, all of these (and more) complete with quotes from the manual at the time talking about reasons behind their use and code where appropriate.

tagged: php2 review manual version phpfi history language

Link: http://phpmanualmasterpieces.tumblr.com/post/65544023819/php-2-0-a-review-in-retrospect

Lorna Mitchell:
Simplest PHP Generator Example
May 23, 2013 @ 10:31:02

On her blog Lorna Mitchell has posted an example of a basic generator written in PHP, a feature of the upcoming PHP version 5.5.

I really like the generators feature that's arriving in PHP 5.5, and since we're now into release candidate releases, it's actually not that far away. I've been speaking on this topic and I thought I'd share my trivially simple code example from my slides.

She includes an example of a very basic generator using the new "yield" keyword and how to implement it in a simple foreach loop. There's also a little talk about when is a good time to use generators in your applications (two examples: complex number calculation and working with large data sets a chunk at a time). For more information on how these generators will work, check out this page in the PHP manual.

tagged: generator simple example introduction manual

Link: http://www.lornajane.net/posts/2013/simplest-php-generator-example

Interview with Jakub Vrana - Co-Author Of The Official PHP Manual
Apr 29, 2013 @ 09:09:22

7PHP.com has another community interview posted today - this time it's with Jakub Vrana, a co-author that works on the official PHP manual.

In this edition I talked with Jakub Vrana who is a co-author of The Official PHP Manual. Adminer and NotORM. I invite you to know him better and to learn from his 7php PHP interview.

The interview shares Jakub's answers about things like:

  • His history as a PHP developer
  • What he sees as good and bad parts of it
  • His preferred tools
  • His choices on frameworks and ORMs
  • How to get started contributing to the documentation/manual
  • Some about his book "1001 tips and tricks for PHP"
tagged: manual coauthor contribute interview community

Link: http://7php.com/php-interview-jakub-vrana