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

Alejandro Celaya:
Project Scalability with Zend Expressive
Jul 21, 2016 @ 09:46:10

In a new post to his site (also posted on the Zend Developer Zone) Alejandro Celaya looks at scalability with Zend Expressive, a lightweight framework from Zend, the creators of the Zend Framework.

I've been working with some different frameworks lately. One of them is Zend Expressive, and I've come to the conclusion that I don't need to choose between different frameworks; depending on the project, Expressive always fits my needs and scales from small projects to bigger applications.

He starts off by looking at the "microframework approach" that Zend Expressive takes, making it easier to get up and running for smaller applications. He points out that this setup is fine when the application is small, but what happens as it grows - it just wouldn't scale well and be manageable. He talks about the setup he uses for larger scale applications, moving the configuration to dynamic config files and making use of more complex dependency injection. He also talks some about modularity in applications, the "middleware paradigm" and how he set up controller-style dispatching (versus just the default closures method).

tagged: zendexpressive tutorial scalability framework microframework update functionality

Link: http://blog.alejandrocelaya.com/2016/07/21/project-scalability-with-zend-expressive/

Rob Allen:
Standalone Doctrine Migrations redux
Jul 07, 2016 @ 12:52:06

Rob Allen has posted a tutorial to his site making some updates to his previous work with the Doctrine migrations handling as a standalone component. In this new tutorial he talks about the newer way to use it in your projects.

Since, I last wrote about using the Doctrine project's Migrations tool independently of Doctrine's ORM, it's now stable and much easier to get going with.

He starts with the basic installation and configuration of the migrations tool, making use of a SQLite database as an example. He then shows the use of the basics of using it to make database changes:

  • creating a new migration
  • running the migrations

Each step comes with code, the commands you'll need to execute and an example of the resulting console output.

tagged: doctrine migration standalone update create execute

Link: https://akrabat.com/standalone-doctrine-migrations-redux/

Symfony Blog:
Announcing the Fourth Symfony Docs Hack Day
May 13, 2016 @ 09:58:29

On the Symfony Blog they've posted the official announcement of their Fourth Symfony Docs Hack Day happening on May 21st. This hack day is focused on just improving the documentation for the framework, not handling bugs in the main codebase itself.

The Symfony project is proud to announce its fourth Symfony Docs Hack Day. This Hack Day will be an online event to give a push to the Symfony Docs before the Symfony 3.1 release at the end of this month.

[...] Hosts Ryan Weaver, Wouter de Jong and Christian Flothmann along with you and all your friends from the Symfony community. The Hack Day is for everyone - we need Symfony experts and newcomers. If you're new to Symfony, you give us a fresh look at the documentation!

The post gives you a bit of an idea what the event will be like and what you can expect, especially as a first time submitter. It will be happening completely online via the "#symfony-docs" channel on the Freenode IRC network. You can prepare by following some of the links in the post to pending pull requests and a list of missing documentation contents.

tagged: symfony hackday documentation update event irc freenode framework

Link: http://symfony.com/blog/announcing-the-fourth-symfony-docs-hack-day

SitePoint PHP Blog:
An Overview of PHPUnit 5 – What’s New? What’s Coming?
May 10, 2016 @ 09:24:37

On the SitePoint PHP blog there's an article posted talking about the next major version of the PHPUnit unit testing tool - PHPUnit 5. It talks about what's new, what's changed and what has been added to help make your testing more effective.

It was January 2016 when the PHPUnit development team [announced](https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.0.0) the release of PHPUnit 5.0.

While several minor version have already been released since, PHPUnit’s major version 5 has introduced several new functionalities and deprecated a few others. In this article, we’ll take a look at the most notable changes.

Included in the list of changes the article mentions are things like:

  • the bump up the minimum PHP version requirements (5.6+)
  • new assertion methods
  • deep object cloning
  • passing mocks along with expectations

Several more are included and, with each some code examples or links to other resources for more information.

tagged: phpunit5 overview preview release features changes update

Link: http://www.sitepoint.com/an-overview-of-phpunit-5-whats-new-whats-coming/

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 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

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