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

Laravel News:
Building and Maintaining a Laravel Translation Package
Oct 22, 2018 @ 11:28:08

The Laravel News site has kicked off a series of posts sharing some of the experiences from Joe Dixon about the creation and maintenance of a Laravel translation package.

In this multi-part series, we’ll be documenting the process of building and maintaining an open-source package for Laravel. We will cover everything from bootstrapping the package to dealing with your first issues and pull requests and as much as we possibly can in between.

In this first part of the series he goes over some of the basics:

  • why they're building the tool
  • what they're planning on creating
  • how they're expecting it to be used

There's a bit of background about the tools they're planning on using and pseudo-code of how it will work.

tagged: laravel translation package series part1

Link: https://laravel-news.com/building-laravel-translation-package

Rob Allen:
Replacing a built-in PHP function when testing a component
Oct 22, 2018 @ 10:55:58

Rob Allen has a new post to his site sharing a method you can use in your testing to replace a built-in PHP function with something customized for your needs.

Recently I needed to test part of Slim that uses the built-in PHP functions header() and headers_sent(). To do this, I took advantage of PHP’s namespace resolution rules where it will find a function within the same namespace first before finding one with the same name in the global namespace. The idea of how to do this came courtesy of Matthew Weier O’Phinney where this approach is used for similar testing in Zend-Diactoros.

He starts off with the code he wants to test - a response method - and a simplified version of the test. This method makes use of the headers_sent and header functions in PHP but those needed to be overridden in order to make the test actually work. He includes the changes to make to the test to override these methods because of how namespaces resolve (using the global PHP namespace last).

tagged: replace builtinfunction tutorial namespace testing unittest slim

Link: https://akrabat.com/replacing-a-built-in-php-function-when-testing-a-component/

Matthew Weier O'Phinney:
The Future of Zend Framework
Oct 22, 2018 @ 09:42:07

Matthew Weier O'Phinney, (former) lead developer on the Zend Framework and Expressive projects, has a new post to his site looking at the future of the Zend Framework and how priorities have shifted.

For the past thirteen years, I've been either consuming Zend Framework or directly contributing to it. Since 2009, I've operated as project lead, and, since then, shepherded the version 2 and 3 releases, added Apigility to the ZF ecosystem, and helped bring middleware paradigms to the mainstream by assisting with the creation of Stratigility and coordination of the Expressiveproject.

[...] In the last three years, I have performed this work under the umbrella of Rogue Wave Software, who acquired Zend in 2015. However, Rogue Wave has recently made a strategic decision to focus its efforts on the Zend Server product of the Zend portfolio.

He also points out that the team largely responsible for the framework and building it over the years (himself, Enrico Zimuel, Zeev Suraski and Dmitry Stogo) will be leaving Rogue Wave and looking for other employment. Don't worry Zend Framework fans - they're going to do everything they can to keep the framework and its ecosystem alive! They're already looking for other sponsors (corporate or otherwise) so let Matthew know if you might be able to help!

tagged: zendframework future roguewave refocus framework ecosystem

Link: https://mwop.net/blog/2018-10-17-long-live-zf.html



Community News:
Recent posts from PHP Quickfix (10.17.2018)
Oct 17, 2018 @ 08:05:02

Recent posts from the PHP Quickfix site:

tagged:

Link:

StarTutorial.com:
Modern PHP Developer - Iterator
Oct 16, 2018 @ 12:08:16

StarTutorial has continued their "Modern PHP Developer" series of tutorials with their latest covering the use of Iterators for working with sets of data.

If you have used a for loop in PHP, the idea of iteration is most likely not foreign to you. You pass an array to a for loop, and perform some logic inside the loop, but did you know that you can actually pass data structures other than arrays to a for loop? That's where Iterator comes into play.

The tutorial starts by introducing some of the basic concepts of what iterators are and how they're represented in PHP in their most basic form: arrays. They cover some of the basic array handing and functions before getting into the actual Iterator object handling. The article is then broken up into a few parts covering iterators and their functionality:

  • Your first iterator class
  • Why iterator?
  • SPL Iterators
  • ArrayObject vs SPL ArrayIterator
  • Iterating the File System
  • Peeking ahead with CachingIterator
  • Generator

Code and a summary of the functionality is included in each section providing you with a great start towards using iterators over simple arrays in your modern PHP applications.

tagged: developer tutorial introduction modern iterator

Link: https://www.startutorial.com/articles/view/modern-php-developer-iterator

TutsPlus.com:
Trigonometry, Random Numbers and More With Built-in PHP Math Functions
Oct 16, 2018 @ 11:56:01

The TutsPlus.com site has another great PHP tutorial for those new to the language covering mathematical functionality in the language, from the basics out to more complex topics like trigonometry and random number generation.

Basic maths is used a lot during programming. We need to frequently compare, add, multiply, subtract and divide different values when writing code.

Sometimes, the maths required in a program can be more involved. You might need to work with logarithmic, trigonometric or exponential functions. In this tutorial, I'll discuss how to use each of these functions in PHP, with examples.

This tutorial will introduce you to the built-in math functions in PHP for doing trigonometry, exponentiation, and logarithm calculations. We'll also look at rounding and generating random numbers.

They start off with some of the "heavy hitters" in PHP's math functionality and how how to perform trigonometric operations with the likes of sin, cos and tan. This is applied to create an interesting dynamic image using the GD functionality. Next up comes the exponential and logarithmic functions with simple examples followed by a section sharing some other useful math functions for more everyday needs.

tagged: tutorial math trigonometry random number introduction

Link: https://code.tutsplus.com/tutorials/mathematical-functions-in-php--cms-31972

Stitcher.io:
Laravel domains
Oct 16, 2018 @ 10:44:58

On the Sticher.io site there's a new tutorial posted where Brendt shares some thoughts about domain driven design and splitting codebases to make them more maintainable and logically separated.

In this post we'll look at a different approach of structuring large code bases into separate domains. The name "domain" is derived from the popular paradigm DDD, or also: domain driven design.

While many concepts in this post are inspired by DDD principles, they will not follow every rule set by the paradigm. In our context, "domain" can also be named "module". A "domain" simply refers to a category of related stuff, that's it.

The post then starts with a definition of what a "domain" is and how it relates to functionality in an application (a Laravel app in this case). He gives an example of restructuring the code into "domains" of functionality rather than thinking about their types (enums, rules, etc). He provides a new proposed directory structure for these domains including folders for Actions, Exceptions, Rules, Status and ValueObjects. He then walks through several of these categories and gives a bit more detail about what's inside and some of the functionality those files might contain.

tagged: domains laravel tutorial domaindrivendesign ddd restructure directory

Link: https://stitcher.io/blog/laravel-domains

PHP.net:
PHP 7.1.12 and 7.2.11 Released
Oct 16, 2018 @ 09:32:08

The main PHP.net site has announced the release of two new versions of PHP in the 7.1 and 7.2 series: PHP 7.1.23 and PHP 7.2.11.

The PHP development team announces the immediate availability of PHP 7.1.23 [and 7.2.11. This is a bugfix release.

All PHP 7.1 [and 7.2] users are encouraged to upgrade to this version.

Bugs fixed in theses releases include updates to the core language, the curl extension, opcaching, reflection functionality and the XMLRPC handling. If you're interested in all of the changes and want more detail, check out their respective Changelogs. As always, you can download these latest releases from the main downloads page or from the windows.php.net site.

tagged: language release php71 php72 bugfix

Link: http://php.net/archive/2018.php#id2018-10-11-3