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

SitePoint PHP Blog:
How to Master Your API Workflow with Postman
Aug 21, 2017 @ 11:13:20

On the SitePoint PHP blog author Younes Rafie has returned with another tutorial, this time with a focus on how Postman can help master your API workflow by making use of several of the features it already includes.

Building good APIs is hard, and anyone who had the chance to do so can relate to this. A project can easily grow to become a mess. One can keep trying to adopt an approach to make it more enjoyable, like trying a documentation-first workflow, but something always feels clumsy.

I was trying out Postman lately, a tool we’ve briefly covered before, and I discovered that they’re doing a great job by providing an integrated environment for different components of an API, like authorization, testing, documentation, versioning, etc.

He then goes through the use of the tool, including screenshots along the way for:

  • Making requests
  • Authorization
  • Environment Variables
  • Testing
  • Validating JSON schemas
  • Working with collections

The post finishes up with a look at generating documentation for the API using Postman's "View in Web" feature including integrating example calls and publishing it. There's also a look at exporting and importing data and a few links to some other helpful resources.

tagged: api workflow tutorial postman tool feature screenshot

Link: https://www.sitepoint.com/master-api-workflow-postman/

North Meets South Podcast:
Conventions, configuration, and becoming a lead developer
Aug 21, 2017 @ 10:55:53

The North Meets South podcast, hosted by Jacob Bennett and Michael Dyrynda, has posted their latest episode: Episode #32 - Conventions, configuration, and becoming a lead developer.

Topics mentioned in this show include:

You can listen to this latest episode either using the in-page audio player or by downloading the show for listening offline. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter to get the latest updates when new episodes are released.

tagged: northmeetssouth podcast ep32 jacobbennett michaeldyrynda convention configuration lead developer

Link: http://www.northmeetssouth.audio/episodes/4579b2fc/conventions-configuration-and-becoming-a-lead-developer

Tideways.io:
Using php-fpm as a simple built-in async queue
Aug 21, 2017 @ 09:25:20

On the Tideways blog Benjamin Eberlei has written up a post showing how to use php-fpm as a "poor man's queue" system, making it easier to hand off requests to be worked on out of band without having to install other software.

There are many tasks that a web-request should not perform directly so the user doesn't have to wait many seconds for a response. [...] The usual advice you find on the internet is to setup a queue such as RabbitMQ, Redis, Kafka, Gearman or Beanstalkd. But this means another service that you need to install, setup, maintain and monitor. With some of the queue systems operating them includes a steep learning phase that requires time and money for additional hardware.

But maybe you just need a poor mans version of an asynchronous queue without all the overhead? Then why not just use PHP-FPM itself?

He admits that it's more of an "experimental approach" but feels like it could be a viable option for the php-fpm users out there. He then shows how to use the hollodotme/fast-cgi-client library to execute an asynchronous request for a "SendEmail" command. The request is then passed off to another PHP-FPM worker for processing without the user having to wait on a result. He ends the post with a few words of warning about using this approach and some other methods for getting around the offloading of longer processing.

tagged: phpfpm asyncronous library tutorial offload processing socket

Link: https://tideways.io/profiler/blog/using-php-fpm-as-a-simple-built-in-async-queue

Laravel News Podcast:
Episode 43 - Laracon US 2017 wrap, Laravel Horizon, and new versions galore
Aug 18, 2017 @ 12:42:34

The latest episode of the Laravel News podcast, hosted by Jacob Bennett and Michael Dyrynda, has posted their latest episode: Episode 43.

Jake and Michael return after a few weeks' hiatus to recap Laracon US 2017, the big reveal of Laravel Horizon, and catch up on the latest framework news.

You can read the full episode transcript which includes time markers and links.

The post also includes links to several of the topics and software mentioned in the episode. If you enjoy the show be sure to subscribe to their feed to get notifications when the latest episodes are released.

tagged: laravelnews laravel podcast ep43 laracon horizon versions

Link: https://laravel-news.com/podcast/43

Zend Framework Blog:
Protecting passwords with Argon2 in PHP 7.2
Aug 18, 2017 @ 11:12:01

On the Zend Framework blog today there's a new post from Enrico Zimuel showing you how you can use Argon2 password hashing in PHP applications (coming natively in PHP 7.2).

PHP 7.2 will be released later this year (2017). This version contains some interesting additions, including two new security features: support of the libsodium library.

With these new features, PHP is the first programming language to adopt modern cryptography in its standard library.

In this article, we demonstrate the usage of the Argon2 password hash algorithm.

He then walks you through the installation of the pre-release version of PHP 7.2 and the argon2 library to get the environment up and running. He briefly talks about what the Argon2 hashing algorithm is and how to use it directly in PHP via the password_hash function. He also mentions the password_get_info function and shows what the result of inspection on an Argon2 application contains.

tagged: password hash argon2 tutorial install usage

Link: https://framework.zend.com/blog/2017-08-17-php72-argon2-hash-password.html

Matt Stauffer:
Laravel Collections’ higher order messaging and “when” method in Laravel 5.4
Aug 18, 2017 @ 10:31:19

In this new post to his site Matt Stauffer looks at the "higher order messaging" in Laravel's collections as a part of his series covering features in Laravel 5.4.

It seems like it was just last year that collection pipelines took over the Laravel world. Taylor had introduced collections to Laravel a while back but they sat somewhat under-appreciated until Adam Wathan wrote his book Refactoring to Collections about how they can transform the way you write a lot of your PHP code.

In Laravel 5.4, collections got a few boosts. Let’s take a look at a few.

He starts by talking about the higher order messaging design pattern and how it is different than just using something like foreach to iterate through a set. He then applies this to the Laravel collections, showing how they're implemented there via the "filter" and "pipe" methods.

tagged: collection higher order when messaging tutorial laravel54

Link: https://mattstauffer.co/blog/laravel-collections-higher-order-messaging-and-when-method-in-laravel-5-4

Twilio Blog:
Creating a Symfony 3 Project with Basic User Handling
Aug 18, 2017 @ 09:56:26

On the Twilio blog they've posted a new tutorial from author Margaret Staples showing you how to create a Symfony 3 project with user handling along with the Friends of Symfony bundle.

User handling is a fundamental part of a ton of web projects. This post will walk through how to get setup using the Symfony 3 framework and the Friends of Symfony bundle so that your project can allow users to register, login and out, and view and edit their User profile. The steps here will serve as a great starting point for your next web project.

She then walks you through the installation of the Symfony standard edition and how to answer some of the interactive setup questions. Once that's set up she shows how to install the FriendsOfSymfony/FOSUserBundle and what configuration options need to be changed to implement it. She then shows how to update the database schema for the new user handling and how to check to be sure the login, registration and profile pages are working as expected.

tagged: symfony3 project user handling tutorial install configure migrate

Link: https://www.twilio.com/blog/2017/08/up-and-running-with-symfony-3.html


Omniceps.com:
Introduction to Latte | Best PHP templating engine
Aug 17, 2017 @ 11:30:15

On the Omniceps site there's a new post introducing you to Latte, the templating component of the Nette framework that can be used independently.

A PHP templating engine is the one which gives you ability to write html for your clients efficiently using PHP variables.

However, PHP was originally built to be a templating engine, but yet it was never used primarily as a templating engine. There has been so many PHP templating engine so far in the market since PHP evolved, but none of them has made as great impression on us as Latte. Introducing you to Latte, one of the best PHP templating engine you have come across so far. Also Latte protects your web app from vulnerabilities like XSS (cross site scripting).

The tutorial starts with an example comparing "plain old PHP" templating with the Latte version for a foreach loop. Next they show how to install the Latte component and the two different kinds of macros the tool includes. They also talk about filters, performance concerns, context aware escaping and "pretty output" options.

tagged: nette framework template component latte introduction tutorial

Link: http://www.omniceps.com/latte-best-php-templating-engine/

Amit Merchant:
Laravel Eager Loading - load() Vs. with()
Aug 17, 2017 @ 10:46:11

In a new post to his site Amit Merchant covers the difference between two functions in Laravel's Eloquent functionality that do similar things: load() versus with() for eager loading.

Today, while working with one of my projects(which is built on top Laravel) I bumped into the situation where I needed to get associated model’s data for one of the models. So here, I had two approaches in Laravel to accomplish this which are basically called Eager Loading: with() [and] load().

Both accomplish the same end results - eager loading a related model onto the first. In fact, they both run exactly the same two queries. The key difference is that with() eager loads the related model up front, immediately after the initial query (all(), first(), or find(x), for example); when using load(), you run the initial query first, and then eager load the relation at some later point.

He then goes through examples of each and the queries they produce on the backend. He shows how splitting up the queries might be a better option for some cases and finishes with the benefits of using each (use cases).

tagged: laravel eager loading load with eloquent

Link: https://www.amitmerchant.com/Laravel-Eager-Loading-Load-Vs-With/