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

SitePoint Web Blog:
Please: Automated CMS and Framework Installs in Vagrant
May 25, 2016 @ 10:29:08

On the SitePoint.com site's "Web" category they're posted a tutorial showing off an interesting piece of software that helps make automated installs of CMS/frameworks easy: a simple bash script tool called Please.

If you’re a web developer, possibly one of your most boring and repetitive tasks is the configuration of the basic setup for every new project. Configuring your my-project.dev domain, creating the database, installing WordPress (or any other CMS/Framework) for the thousandth time: you already know how to do it. What if you could automate all of that?

Well, actually, you can. Please is a simple bash script that helps to automate the installations of many CMSs and Frameworks by configuring them automatically into your Vagrant box, adding a development domain name into your host file, and even a database if needed.

They start off by helping you get a Vagrant box up and running to use for the Please handling. You then clone the Please repository locally and can use the command line tool to set up the process for multiple CMS/framework types including WordPress, Laravel and React. There's also a section covering the creation of your own environment if you need something more custom. Please is currently in beta at the time of this post so be aware that there may still be issues that need resolving before it becomes stable.

tagged: please automated installation tool commandline cms framework vagrant

Link: https://www.sitepoint.com/please-automated-cms-and-framework-installs-in-vagrant/

Free the Geek:
Episode 18 - Talking Conferences and Mental Health with Matthew Turland
May 25, 2016 @ 09:25:26

The Free the Geek podcast hosted by PHP community member Matthew Setter has posted its latest episode. In this new show Matthew talks with Matt Turland about conferences and mental health.

In this episode I wonderful chat with Matthew Turland about what it’s like speaking at conferences and mental health - especially within the IT community.

It’s a chat which I feel privileged to have had, primarily because it can be such a sensitive topic for so many people around the world. Matthew was very kind to open up to me and share with me some of his struggles, and how he’s dealt with them over the years.

He also shared a host of links to some excellent resources, should you or someone you know, be in the same position; links which you can find in the related links section.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. If you enjoy the show and want to hear more chats with members of the PHP community, be sure to subscribe to their feed and follow the show on Twitter to get the latest updates when new episodes are released.

tagged: freethegeek podcast matthewsetter ep18 matthewturland conference mentalhealth

Link: http://freethegeek.fm/episode/episode-0018

Community News:
Recent posts from PHP Quickfix (05.25.2016)
May 25, 2016 @ 08:05:01

Recent posts from the PHP Quickfix site:



Using Let's Encrypt SSL With Your WordPress Project
May 24, 2016 @ 12:53:11

The TutsPlus.com site has posted a tutorial for the WordPress users out there about using Let's Encrypt and SSL certificates to easily secure your installation.

For years, purchasing, renewing, installing and managing SSL certificates overwhelmed me with expense and complexity. Now, Let's Encrypt makes it fairly simple and free.

Let’s Encrypt is an emerging, free, automated, and open certificate authority brought to you by a California public benefit corporation called the Internet Security Research Group—it also has nonprofit status. [...] In this tutorial, I'll walk you through installing Let's Encrypt on a few of my websites, including my WordPress consulting website, http://lookahead.io, soon to be https://.

You'll need a be a bit comfortable working at the command line to use the Let's Encrypt client, but they walk you through each step of the process explaining everything along the way. They start with a basic list of features the Let's Encrypt service provides and the requirements you'll need to get started. Screenshots of the setup wizard are included and the "one small difference" you'll need to make when using it with WordPress. They link to the SSL Labs site to help you verify the certificate is working as expected and finish with setting up the auto-renewal of the certificate via a simple cron job.

tagged: wordpress letsencrypt install setup configure ssl certificate free

Link: http://code.tutsplus.com/tutorials/using-lets-encrypt-ssl-with-your-wordpress-project--cms-22303

Marc Scholten:
Accidental Complexity Caused By Service Containers In The PHP World
May 24, 2016 @ 11:25:30

In this post to his site Marc Scholten talks about something that's become a side effect of using the inversion of control design pattern in PHP applications (specifically related to dependency injection): added accidental complexity.

Modern PHP development favors the use of inversion of control to keep software more configurable and flexible. This leads to the problem that one now has to create a big graph of objects to use the application. As a solution to avoid redundant setup code, service containers like the symfony2 dependency injection component are used.

The goal of a service container is to centralize the construction of big object graphs. [...] Simple, right? Actually it’s not. Commonly used service containers are complex solution for simple problems.

He illustrates with an example using the Symfony services container, a piece of the framework that allows the definition of dependency relationships via a YAML formatted file. While this configuration seems simple enough, he points out that more complex dependencies (ones that could easier be set via a "set" method) become more difficult to define when limited by the service container config structure. He also points out that it makes static analysis of the code much more difficult with dependencies being dynamically fetched from the container instead of directly related. He offers an alternative to this complex container setup, however: a simple method (or methods) inside of a factory class that creates the objects, injects the required dependencies. This makes it much easier to call from the service container instance and configuration and even a "create container" call to set all of the dependencies up at once. He ends the post with some advantages of this approach and a takeaway or two to keep in mind when managing your object dependencies.

tagged: complexity service container accidental configuration simplex complex example symfony

Link: https://www.mpscholten.de/software-engineering/2016/05/21/accidental-complexity-caused-by-service-containers-in-the-php-world.html

Andrew Carter:
PSR-7 Objects Are Not Immutable
May 24, 2016 @ 10:28:05

Andrew Carter has written up a new post about PSR-7 objects (the PHP-FIG defined standard for handling requests and responses in PHP applications) and how the objects themselves are immutable.

What’s happening [in the provided example] is that the Zend Expressive framework is rendering the error page to the same object that you wrote your message to. Whilst the actual message object itself is immutable, the body stream that it references is not. Even when this object is cloned or “modified” (to become a new object) it will still use the same stream.

He explains a bit about what this means in a more practical sense and why the PSR-7 standard and why this happens (as defined after much discussion). Then he gets into a more recent debate happening in the PHP-FIG about PSR-7 middleware and the proposal for a standard structure in its creation. He points to some of the thoughts from Anthony Ferrara on the topic and an example from Woody Gilk showing an exception handler and how having the stream always appending content is a bad thing in that particular case.

tagged: psr7 object immutability output zendexpressive middleware stream

Link: http://andrewcarteruk.github.io/programming/2016/05/22/psr-7-is-not-immutable.html

Voices of the ElePHPant:
Interview with Beau Simensen
May 24, 2016 @ 09:18:27

The Voices of the ElePHPant podcast has posted their latest interview with another member of the PHP community: Beau Simensen, a developer on the Sculpin static site generator project. This is another in their series of video interviews done live at the [php]world conference.

Cal and Beau talk some about Sculpin and some of the responsibility that comes with working on a large, popular open source project. They also talk about burnout and some of the things that Beau has done in his own life to help avoid it. There's also some discussion about Beau's new role at Monii.com and the experience of moving to the UK from the US (along with his family).

You can catch this latest episode in a few different ways - either by downloading the mp3 of the show directly or using the in-page audio or video players. If you enjoy the show be sure to subscribe to their feed and follow them on Twitter.

tagged: voicesoftheelephpant interview calevans beausimensen community phpworld15

Link: https://voicesoftheelephpant.com/2016/05/24/beau-simenson/

Community News:
Latest PECL Releases (05.24.2016)
May 24, 2016 @ 08:05:02

Latest PECL Releases:

  • v8js 1.3.0
    This release merges changes from V8Js for PHP 5.x (version 0.6.3) to PHP 7.0 branch.

    New Features

    • Allow to adjust the considered "amount of external memory" by objects exported to V8

    Bug Fixes

    • Pass back V8Object instances, don't re-wrap
    • Retain object identity on 'return $this'
    • Retain object identity on JS-side 'return this'
    • Send LowMemoryNotification signals to V8 before imposing memory limit
    • Fix build against V8 version 5.2 (deprecated WeakCallbackInfo & GetHiddenValue et al)
    • Improve/Clarify README

    Code Cleanup

    • Removed support for "old-age" V8 versions (i.e. V8 < 4.6.76)
    • Removed old examples and pre-phpt test script
  • v8js 0.6.3
    Bug Fixes - Send LowMemoryNotification signals to V8 before imposing memory limit - Fix build against V8 version 5.2 (deprecated WeakCallbackInfo & GetHiddenValue et al) - Improve/Clarify README

    Code Cleanup

    • Removed support for "old-age" V8 versions (i.e. V8 < 4.6.76)
    • Removed old examples and pre-phpt test script
  • pq 2.1.1
    * Fix build with PostgreSQL < 9.3 * Fix required PHP version in package.xml
  • pq 1.1.1
    * Fix build with PostgreSQL < 9.3
  • pq 1.1.0
    * Added public readonly array pqResult::$diag property, listing PQresultErrorField details (gh-issue #14) * Restore listeners and prepared statements after a connection reset (gh-issue #15) * Added pqConnection::$nonblocking and pqConnection::flush() to support non-blocking writes (gh-issue #16)
  • pq 2.1.0
    * Added public readonly array pqResult::$diag property, listing PQresultErrorField details (gh-issue #14) * Restore listeners and prepared statements after a connection reset (gh-issue #15) * Added pqConnection::$nonblocking and pqConnection::flush() to support non-blocking writes (gh-issue #16)
  • SeasLog 1.5.6
    - Fixed issue #76 #80 #86 Fixed segment fault with PHP7. - Make memory usage more stable, and clear memory leaks with PHP5.* and PHP7.*.
  • scrypt 1.4.2
    Fixed memory leak in PHP 7 (#48), weak CSPRNG on salts in the example file (#44)
  • scrypt 1.4.1
    Fixed issue on RHEL 6 in x86_64 with PHP 7 (#46)
  • scrypt 1.4
    Added PHP 7 support (#39, #40, #45)

    Removed support for PHP 5.2 as Travis no longer supports testing it.



SitePoint PHP Blog:
Localizing Dates, Currency, and Numbers with Php-Intl
May 23, 2016 @ 12:52:32

On the SitePoint PHP blog Younes Rafie has continued his series about the PHP "Intl" extension for use in internationalizing an application. in this second part of the series he moves away from just strings and looks at using it for currencies and numbers.

The first part of this series was an introduction of the PHP Intl extension and of how to localize your application’s messages. In this part, we’re going to learn about localizing numbers, dates, calendars, and similar complex data.

The post is broken down into a few different sections, each with their own examples:

  • Localizing Decimals
  • Localizing Currencies
  • Timezones
  • Calendars

The "Intl" extension makes these operations relatively simple with plenty of built-in objects and methods to help with the translations between the formats. You can find out more about this extension in the PHP manual.

tagged: date currency localization number tutorial intl extension series part2

Link: https://www.sitepoint.com/localizing-dates-currency-and-numbers-with-php-intl/

Anthony Ferrara:
All About Middleware
May 23, 2016 @ 11:06:10

Anthony Ferrara has written up a post for his site sharing more information about middleware and the PSR-7 proposal that's being discussed to help standardize interfaces with this popular form of application processing.

Last week, a proposal to standardize middleware for PSR-7 was introduced to the PHP-FIG. The general concept of middleware is not a new one, and has been in use in the PHP world for many years. Several people have raised significant concerns with the proposal, which have gone completely unheeded by the author. Let me go through the most major of these concerns, as well as show what a better proposal might look like.

He starts off with a brief look at the current proposal - the interface it defines and an example of a real world usage of it to check some attributes on the request/response. He gives a few more examples before getting into what he sees as the fundamental problem with the interface: that it passes in a response instance rather than creating its own ("what does $response mean inside the middleware?"). He's mostly talking about context and not knowing from one middleware to the next what kind of changes may have been made to the response. He also includes some of the arguments on the "for" side of including the parameter and an interesting list of middleware that does this modification prior to the next() call, making it difficult to determine the actual state.

He ends the post with a few other issue he has with the proposal including the use of the __invoke method name, a restriction on typing and the next method being callable. He makes a few suggestions of modifications to the proposal that he thinks could help make it better, correcting these issues.

tagged: middleware psr7 proposal opinion example problem

Link: http://blog.ircmaxell.com/2016/05/all-about-middleware.html