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

Jeff Madsen:
Eloquent Create, Update, New...the Untold Story 2016-04-01
Apr 06, 2016 @ 12:19:20

Jeff Madsen has a quick post to his site with the "untold story" behind Eloquent's save and create in the Laravel framework.

Over on Laravel Quick Tips we've been looking at a few of these functions and their uses, and I thought it might be helpful to collect all of them together in a single (I hope) coherent post.

Without further preamble, let's get to it. I'm going to use the basic User object and table that ships with a default installation of Laravel so you can follow along if you like.

He starts with the difference between "new" and "create", pointing out the one fundamental difference: one saves, one does not. He then looks at some of the other new/create functions (like findOrNew, firstOrCreate, updateOrCreate), what each of them does in the background and a quick snippet of code showing.

tagged: eloquent laravel create update new behindthescenes difference save

Link: http://codebyjeff.com/blog/2016/04/eloquent-create-update-new-the-untold-story

PHP.net:
PHP 5.6.20 & 5.5.34 Released
Apr 01, 2016 @ 09:22:01

The main PHP.net site has officially announced the release of the latest versions in the PHP 5.5.x and 5.6.x series: PHP 5.6.20 and PHP 5.5.34.

The PHP development team announces the immediate availability of PHP [5.6.20 and 5.5.34]. This is a security release. Several security bugs were fixed in this release. All PHP [5.6 and 5.5] users are encouraged to upgrade to this version.

These releases fix issues in several parts of the language including Curl handing, Fileinfo, Mbstring and ODBC. You can get these latest versions from the main downloads page or windows.php.net for the Windows binaries.

tagged: language release php56 php55 bugfix security update download

Link: http://php.net/archive/2016.php#id2016-03-31-4

Symfony Blog:
New in Symfony 3.0
Mar 16, 2016 @ 09:39:21

On the Symfony blog there's a new post briefly looking at Symfony 3 and what's different about it as compared to previous releases (and what's not).

Symfony 3.0.0 was released on November 2015 as planned by the Symfony 3 roadmap. As we do with any new Symfony version, we should publish a blog series explaining its new features.

However, Symfony 3.0 is a very special version which contains no new features comparing it with Symfony 2.8. Their only difference is that 3.0 removed any feature marked as deprecated in 2.8. That's why we won't publish any "New in Symfony 3.0" post. Instead, let's do a quick recap of the new Symfony 2.8 features which are also available on Symfony 3.0.

Among the items on their list are things like:

  • New components like Guard Authentication and LDAP
  • A MicroKernel component
  • Improvements for VarDumper, Console and the Security components

Each of the changes on their list include links to get more information about the component and the post wraps up with a quick "how-to" on upgrading to Symfony 3 from other releases.

tagged: symfony symfony3 update release component change deprecation

Link: http://symfony.com/blog/new-in-symfony-3-0

SitePoint PHP Blog:
Re-Implementing the Range Operator in PHP
Mar 09, 2016 @ 12:21:08

The SitePoint blog has a new post that revisits a previous tutorial about implementing a custom operator - the "range" operator - natively in PHP itself. In this new article (again, a repost from the article by Thomas Punt) he comes back and refines the implementation a bit to fix some of the issues with the previous version.

In the prequel to this article (hint: make sure you’ve read it first), I showed one way to implement a range operator in PHP. Initial implementations, however, are rarely the best, and so it is the intention of this article to look at how the previous implementation can be improved.

He starts by mentioning some of the drawbacks to the previous implementation, mostly that the computation of the value would only happen at runtime (slower) and not compile time. He then goes through the code from before and shares the updates to make that allow this compile-time option to work on the lexer, parser and adding in new code for the compilation stage. Finally he makes the updates the Zend VM to allow for these changes to take effect.

tagged: reimplement range operator tutorial source update

Link: http://www.sitepoint.com/re-implementing-the-range-operator-in-php/

PHP Roundtable:
039: From Idea To Production: Part 2
Mar 01, 2016 @ 09:50:43

The PHP Roundtable podcast has posted their latest episode, the second part of a series devoted to working "from idea to production" - Episode #39.

We get an update on status of the project we discussed in part 1 and discuss next steps to take our dance event management app idea to production.

Like in part one of the series, host Sammy Kaye Powers is joined by guests Steven Maguire, Jocelyn Lopez and Glen Hinkle. You can watch the recording of this live show either using the in-page video player or directly on YouTube. If you enjoy the show and want to see future episodes, be sure to subscribe to their feed and follow them on Twitter for updates as they're released.

tagged: phproundtable podcast video part2 series idea production update

Link: https://www.phproundtable.com/episode/part-2-turning-an-idea-into-code-for-production

Toptal.com:
Data Encoding: A Guide to UTF-8 for PHP and MySQL
Jan 28, 2016 @ 13:22:56

The Toptal.com blog has posted a guide to data encoding in PHP and MySQL looking specifically at the use of UTF-8 and related handling. They talk about some of the updates you'll need to make to configurations, code and the MySQL settings to fully support this character set.

As a MySQL or PHP developer, once you step beyond the comfortable confines of English-only character sets, you quickly find yourself entangled in the wonderfully wacky world of UTF-8.

[...] Indeed, navigating through UTF-8 related data encoding issues can be a frustrating and hair-pulling experience. This post provides a concise cookbook for addressing these issues when working with PHP and MySQL in particular, based on practical experience and lessons learned (and with thanks, in part, to information discovered here and here along the way).

They start with the changes on the PHP side, updating the INI settings to make UTF-8 the default character set and which functions you'll need to update and replace. With those changes out of the way they move to the MySQL side, changing up settings in the my.cnf file and a few other things to consider on the database side (including that the MySQL support for UTF-8 is only a partial character set).

tagged: toptal data encoding mysql utf8 update configuration code

Link: http://www.toptal.com/php/a-utf-8-primer-for-php-and-mysql

Jordi Boggiano:
New Composer Patterns
Dec 21, 2015 @ 11:52:36

Jordi Boggiano, lead developer on the Composer has posted about some of the new Composer patterns that have been introduced into the tool this year, including some you might not even have realized.

Here is a short update on some nice little features that have become available in the last year in Composer.

He includes five of these features in his list (but something tells me these are just some of the more user-facing improvements the project has introduced):

  • Checking dependencies for bad patterns
  • Referencing scripts to avoid duplication
  • Defining your target production environment in composer.json
  • Excluding paths from the optimized classmap
  • Requiring packages easily and safely

For each item he includes the command (and sometimes optional arguments) that make it work and what kind of results you can expect. There's definitely some handy features in here and not just for the "power users" in the crowd.

tagged: composer feature update project patterns duplication environment classmap

Link: http://seld.be/notes/new-composer-patterns

Matthew Weier O'Phinney:
Secure PHAR Automation
Dec 15, 2015 @ 12:32:54

There's always been an issue with the creation of Phar packages in PHP and the security around them. There's been recommendations about creating signatures and only using secure connections for updates and rollbacks. Unfortunately there isn't an overly easy way to handle this yet. However, Matthew Weier O'Phinney has written up a post showing his workflow for doing these kinds of things, making use of the Box project to help with some of the more detailed parts.

For a variety of reasons, I've been working on a utility that is best distributed via PHAR file. As has been noted by others (archive.is link, due to lack of availability of original site), PHAR distribution, while useful, is not without security concerns, and I decided to investigate how to securely create, distribute, and update PHAR utilities as part of this exercise.

This is an account of my journey, as well as concrete steps you can take to secure your own PHAR downloads.

He starts by outlining the "roadmap" of the features he wants to include and the steps to take to create this more secure phar archive. It includes the use of both current, local tools and services (like Box and GitHub pages). He then walks through the steps in the full process:

  • Create an OpenSSL Key
  • Use Box to create the PHAR
  • Generate a version file
  • Create the gh-pages branch
  • Write self-update/rollback commands
  • Enable Travis-CI for the repository
  • Create an SSH deploy key
  • Archive and encrypt the secrets
  • Write a deployment script
  • Add the script to travis

While this seems like a lot of steps to just get a more secure phar set up, Matthew has done the hard work for you here and includes all of the commands, configuration examples and steps you'll need to take to fully set the process up. If all goes well, his example in his last "push and watch it work" section will go off without a hitch.

tagged: phar archive security signed https update rollback travisci tutorial

Link: https://mwop.net/blog/2015-12-14-secure-phar-automation.html

Developer Drive:
Looming PHP 7 and its effect on WordPress
Nov 26, 2015 @ 11:54:15

On the Developer Drive site they've posted an article for all of the WordPress users (and other curious folks) about the impact PHP 7 will have on the current WordPress system.

It’s no big secret now that PHP 7 is just on the horizon, and with that development comes questions on how it affects sites that run on WordPress. PHP 7 is a massive update to the server-side web development language called PHP, yet it’s also going to have an impact on any PHP-powered CMS like Drupal, Joomla and Magento.

They go through some of the major changes in PHP 7 and talk briefly about what kind of effects they'll have on those running this popular CMS including:

  • Performance upgrades
  • New and improved operators
  • Continuous 64-bit support
  • Anonymous class support

They recommend that you keep an eye out for messages from your host that they might be upgrading, backing up your site to prevent loss and update your plugins/themes prior to any PHP 7 switch over.

tagged: php7 wordpress features update recommendation hosting

Link: http://www.developerdrive.com/2015/11/looming-php-7-and-its-effect-on-wordpress/

Zend Framework Blog:
Zend Framework 3 Update and Roadmap
Nov 26, 2015 @ 09:47:33

On the Zend Framework blog they've posted the roadmap and latest updates on the work being done for the next major version of the framework: Zend Framework 3.

In October, while at ZendCon, I presented a talk on Zend Framework 3 entitled "Components, PSR-7, and Middleware: Zend Framework 3." You can view it online, but this post discusses current status, details some decisions, and points to the work still to be done. It's a long read; grab a warm beverage, maybe some popcorn, and take your time.

They start by outlining some of the major concepts that ZF3 integrates and are key to how it will handle requests:

  • the component-based system it's built on, making major use of Composer-style packages and installation techniques
  • using the PSR-7 standard for handling of HTTP requests and responses
  • the use of middleware to modify the request/response and add logic

Finally, they get into the overall view and roadmap for the framework. They talk about the ServiceManager/EventManager, the role middleware plays in the request dispatching and the goal of reducing dependencies. The post ends with a look at the improvements they're striving for with new and better documentation and the next steps in the roadmap for the coming months.

tagged: zendframework3 roadmap update overview psr7 middleware component documentation

Link: http://framework.zend.com/blog/zend-framework-3-update-and-roadmap.html