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

Mark Baker:
PHP Generators – Sending “Gotchas”
Oct 11, 2016 @ 11:54:52

In this post to his site Mark Baker has shared some "sending gotchas" when generators are used in you PHP code. The focus of the article is on the "sending" part, pushing data into the generator for evaluation and use.

If you’re reading this, you’re probably already aware of just how useful PHP’s Generators are for improving performance and/or reducing memory overheads while keeping your code clean and easy to read.

Unlike their equivalent in some programming languages, PHP’s Generators allow you to send data into the Generator itself; not simply at initialisation (the arguments that we pass to the Generator when instantiating it); but also between iterations. This has its own uses, and again, allows us to move code from our main blocks and methods into the Generator itself. [...] However, there are a few “gotchas” when we combine Generators that both return and accept data in this way, and it really helps to be aware of them when we’re developing, otherwise it can create problems.

He starts simple, showing a generator that uses integers passed in as the starting number and addition interval for each loop. He gets a bit more complex in his next example, having a method called inside the loop. While the first instance of this behaves as expected, the second (after minor modification) yields unexpected results. He walks you through what's happening to produce those results and one possibility on how to get it corrected.

tagged: generator gotcha issue unexpected results debugging workaround

Link: https://markbakeruk.net/2016/10/08/php-generators-sending-gotchas/

October 2016 Issue Released - Pillars of Development
Oct 04, 2016 @ 09:55:07

php[architect] magazine has just announced the release of the latest edition of their magazine, the October 2016 issue: Pillars of Development.

Articles in this issue include:

  • Juggle Arrays Using Functional Callbacks (Andrew Koebbe)
  • Dev Divas: History’s Heroines of Computing, Part One (Vesna Vuynovich Kovach)
  • The Strangler Pattern, Part One (Edward Barnard)
  • API Tips From the Front Line (Anna Filina)

The usual columns are also back including the "Education Station", "Security Corner" and "Leveling Up". If you'd like a sample of the contents of the issue, they're also offering a free article, "COTS, Open Source, Build it Yourself, or Something in Between?" by Eli White. If you pick up your own copy of this latest edition directly from the php[architect] website either as an individual issue or as a subscription (either digital only, print only or combined).

tagged: phparchitect magazine october2016 pillars development issue release

Link: https://www.phparch.com/magazine/2016-2/october/

Michelangelo van Dam:
PHP 7 on macOS Sierra
Sep 26, 2016 @ 09:24:18

Michelangelo van Dam has posted a "follow up" to his previous article about setting up a PHP installation on the recent versions of Mac OSX. In this new tutorial he makes some updates for the latest OS X release: Sierra.

Apple has released the latest version of their OS X operating system to the broad public and many have already upgraded their mac devices. But as it goes with each release, Apple likes to do things a bit different making it quite challenging for PHP developers to stay current with the latest PHP version (or other versions).

This version of mac OS (11.12) comes pre-installed with PHP 5.6.24. [...] Good for Apple, but this version reaches end-of-life support by the end of this year, so it would be great if you could upgrade to PHP 7.0 or even play with the latest PHP 7.1 release candidates.

While he points out that things like XAMPP and Homebrew can be used to set the installation up, he focuses more on compiling and installing it natively. He shares an issue he had with a missing runtime and how to get it installed and working happily so the PHP compile completes without issues.

tagged: mac osx runtime compile php7 sierra issue tutorial

Link: http://www.dragonbe.com/2016/09/php-7-on-macos-sierra.html

September 2016 Issue Released - Legacy Code of the Ancients
Sep 02, 2016 @ 13:29:06

php[architect] magazine has officially announced the release of their September 2016 issue: Legacy Code of the Ancients.

We don’t always have the luxury of working on greenfield projects where we can try out the latest language features, component libraries, or programming techniques. More often, we’re asked to take care of and add features to an application that just works and supports a company or organization’s objectives—like making money to pay salaries. Unless it’s a relatively new project, you are sure to run into corners of the codebase that should be modernized. The trick is to find the time and marshal your team to do so.

Articles in this month's edition include:

  • "Illuminating Legacy Applications" (Colin DeCarlo)
  • "Legacy Code Needs Love Too" (John Congdon)
  • "Building for the Internet of Things in PHP" (Adam Englander)

The usual columns are there as well including the "Education Station" and "Security Corner". You can pick up your own copy of this month's issue directly from the php[architect] site. If you just want a sample of the content, check out this month's free article - "The Modernization of Multiple Legacy Websites".

tagged: phparchitect magazine september2016 legacycode legacy issue release

Link: https://www.phparch.com/magazine/2016-2/september/

June 2016 Issue Released - Decoupled by Design
Jun 02, 2016 @ 14:58:51

php[architect] magazine has published their latest edition - the June 2016 issue, Decoupled by Design.

The June 2016 issue of php[architect] magazine is now available! Less tightly coupled code is easier to debug and re-use. This month we look at techniques to decouple different aspects of your code: including using asynchronous & distributed workers, transducers, middleware, and secure web services.

The issue includes articles like:

  • "Security Architecture: Securing your Web Services, Part Two" (Edward Barnard)
  • "The Middleware Awakens" (Ian Littman)
  • "MySQL’s JSON Data Type" (Dave Stokes)

...as well as several of the usual columns sharing community and professional development tips. If you're not a subscriber and want a sampling of the content, be sure to check out the free article for this month covering video manipulation with FFmpeg. You can also pick up a subscription directly from the php[architect] site if you want to read more.

tagged: phparchitect magazine june2016 decoupled design issue release

Link: https://www.phparch.com/magazine/2016-2/june/

May 2016 Issue Released - Full Speed Ahead
May 03, 2016 @ 12:18:25

On the php[architect] site today they've announced the release of their May 2016 issue: "Full Speed Ahead".

We’ve just released the May 2016 issue of php[architect] magazine. To help you make good use of your development time, this month the magazine looks at libraries including DoctrineORM and FastRoute, and product development lessons from building Laravel Shift.

In addition, this month includes articles on defining “Senior Developer”, the value of gratitude, keeping credentials safe, securing web services, and the value of hindsight.

This month's issue also includes articles covering OAuth 2 and all of the usual columns (Education Station, Leveling Up, Community Corner, Security Corner). As always they provide one article free so you can get a taste of the latest issue. This time it's the article from Edward Barnard covering web services security. You can pick up a copy of your own directly from the php[architect] website or just get a year long digital or print subscription while you're there.

tagged: phparchitect magazine may2016 fullspeedahead issue release

Link: https://www.phparch.com/magazine/2016-2/may/

Leonid Mamchenkov:
Adventure in composer private repositories
Apr 22, 2016 @ 09:19:44

In this new post to his site Leonid Mamchenkov talks about some of his "adventure with Composer private repositories" in some of his deployment work with CakePHP 3 applications.

As good as the Packagist is, there is often a need for a repository or a package elsewhere. Whether it’s a commercial library, or sensitive corporate code, having an ability to store it outside of public eye and handle with the same ease and the same tool as the rest of the dependencies is a very welcome feature.

[...] We are setting up similar development and deployment process, but now for CakePHP-based projects. Things are much easier, since CakePHP 3 natively supports composer for the application itself and for its plugins. But we still have the need for private repositories here and there, so we follow the same setup as we did for WordPress.

Unfortunately he was getting a RuntimeException when he was trying to pull in a plugin through the same private repository workflow. Not only had he not seen the error before but the autoloader was configured as defined and other plugins were working with the same structure. As it turns out, it was the composer.json of the main application repository that was the problem. He includes the fix he made to the configuration on a sample CakePHP 3 project, showing how to switch it to a "vcs" type for more correct handling.

tagged: composer private repository issue runtime exception composerjson configuration

Link: http://mamchenkov.net/wordpress/2016/04/21/adventure-in-composer-private-repositories/

Niklas Keller:
Let's Encrypt with PHP
Mar 16, 2016 @ 13:05:32

The introduction of the LetsEncrypt free SSL certificate service has made making your site SSL only a much easier process than ever before. They've made it even easier by allowing automation around certificate setup and renewal. In this post to his site Niklas Keller shows you how to use a PHP implementation of a tool to setup/refresh your certificates automatically.

Let’s Encrypt, the free and automated CA, started late last year into their public beta. They offer a pretty comprehensive client to automate the process of getting SSL clients and installing them. It will soon be moved to a new home at EFF.

If you’re already using PHP and don’t need / want the automatic installation of your free certificates or don’t want to install Python, here’s a client for you. kelunik/acme-client is able to issue and renew certificates using your already running webserver (e.g. Nginx or Apache). It’s using the http-01 challenge to prove your domain ownership / control to Let’s Encrypt.

He shows how to use the client to set up a new LetsEncrypt account (if you don't already have one) and issue a certificate through a few command line calls. He then shows how to automate the process to check your certificate expiration and load the updated certificates. He also includes an example of the command to revoke a certificate, just in case.

tagged: letsencrypt ssl certificate client acme example refresh issue revoke

Link: http://blog.kelunik.com/2016/03/13/letsencrypt-php-client.html

PHP 5.5.33, 5.6.19 & 7.0.4 Released
Mar 04, 2016 @ 12:38:49

The latest releases of all major (and minor versions) of the PHP language have been released with several bugfixes including correcting a few security issues: 5.5.33, 5.6.19 and 7.0.4.

The PHP development team announces the immediate availability of PHP [5.5.33, 5.6.19 and 7.0.4]. This is a security release in which two security bugs were fixed. All PHP users are encouraged to upgrade to this version.

You can find out more information about what changes were made in these releases in the PHP 5 Changlog and PHP 7 Changelog along with references to the related bug information. As always, you can download these latest releases from the main PHP.net site or your favorite mirror linked from the main downloads page. Windows users can get the latest binaries from windows.php.net.

tagged: language release php5 php7 bugfix security issue

Link: http://php.net/downloads

March 2016 Issue Released - Mutant Testing
Mar 02, 2016 @ 11:09:08

php[architect] has officially released the latest edition of their magazine for March 2016 - Hunting Mutants. This new issue includes articles about compilers/interpreters, Laravel's Eloquent ORM and Zend Expressive.

Unless you’ve been cryogenically frozen for the past few years, you’ve no doubt heard about how important automated testing is as well as TDD, BDD, Continuous Deployment, and other acronyms. Either you’ve read an article in a past issue of this magazine or you’ve heard it from numerous advocates at conferences, on blogs, and on twitter. This month’s issue features two articles on Mutation Testing with Humbug.

This month's article also includes a free sample, the article covering Eloquent, the ORM for the Laravel framework. All of the usual columns are back in this edition as well including the Education Station, Leveling Up and the Security Corner. You can pick up an issue of your own directly from the php[architect] site for just $6 USD or a full year's subscription for $49 USD.

tagged: phparchitect magazine march2016 mutant testing issue release

Link: https://www.phparch.com/magazine/2016-2/march/