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

PHP Roundtable Podcast:
Episode 073 - PHP Static Analysis
Jun 21, 2018 @ 12:26:08

The PHP Roundtable podcast, hosted by PHP community member Sammy Powers, has posted their latest episode: #73 - PHP Static Analysis. In this episode Sammy is joined by Ond?ej Mirtes, Craig Duncan, Vladimir Reznichenko and Damien Seguy.

Static analysis is a fancy word to describe a tool that looks at our code and gives us helpful hints on how to improve it. We'll be discussing what static analyzers do, which tools the PHP community has access to, and how we can incorporate the tools into our daily development flow.

You can catch this latest episode in a few different ways: either using the in-page audio or video player, by downloading the audio file directly or by watching the recording over on Youtube. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.

tagged: phproundtable ep73 podcast sammypowers static analysis

Link: https://www.phproundtable.com/episode/using-static-analyzers-to-improve-our-php-codebases

SitePoint PHP Blog:
Building an Image Gallery Blog with Symfony Flex (Parts 1 & 2)
Jun 21, 2018 @ 11:48:56

On the SitePoint PHP blog they've kicked off a series by Zoran Antolovic walking through the creation of a blog application using the latest from the Symfony project - Symfony Flex.

Our journey towards a stable, robust, high-performance web app will start with the simple but functional application — the so-called minimum viable product (MVP). We’ll populate the database with random content, do some benchmarks and improve performance incrementally. Every article in this series will be a checkpoint on our journey!

This article will cover the basics of setting up the project and organizing files for our Symfony Flex project. I’ll also show you some tips, tricks and helper scripts I’m using for speeding up the development.

So far they've posted the first two articles of the series:

  • Part one explaining some of the basics of Flex and getting the application set up (including some sample fixture data)
  • Part two showing how to populate the application with more realistic data, run some basic performance tests and create a first unit test

There's much more to come in the series including the creation of file (image) upload handling, user registration and login and the creation of image galleries from uploads.

tagged: image gallery blog tutorial symfonyflex symfony flex part1 part2

Link: https://www.sitepoint.com/building-image-gallery-blog-symfony-flex-setup/

PHP.net:
PHP 7.3.0 alpha 2 Released
Jun 21, 2018 @ 10:08:28

The main PHP.net site has posted the announcement about the release of the latest alpha for the PHP 7.3.x series: PHP 7.3.0 Alpha 2.

This is a development release and is not intended to be used in production. Several bugs were fixed including issues with:

  • command line output
  • a Mysqlnd truncation problem
  • Opcache
  • date interval handling
  • parsing files in the tokenizer

You can see the full list of changes and related bugs in the NEWS file section for the release. As always, this release can either be downloaded from the main downloads page for source packages or windows.php.net for the Windows binaries. The next release, Alpha 3, is scheduled for July 5th which should be followed by the official branching of 7.3 pre-beta.

tagged: language alpha release php73alpha2

Link: http://php.net/index.php#id2018-06-21-1

Sameer Borate:
PHP Simple HTML DOM Parser Script
Jun 21, 2018 @ 09:26:38

Scraping content from other sites (while slightly controversial) can be a helpful way to pull information into your application without the overhead of manual interaction. In this new post to his site Sameer Borate shows how to use a DOM parser to extract data from a remote site.

In this post I have explained some elements to scrap data from external websites. Simple HTML DOM parser is a PHP 5+ class which is useful to manipulate HTML elements. This class can work with both valid HTML and HTML pages that do not pass W3C validation. You can find elements by ids, classes, tags and many more. You can also add, delete or alter DOM elements. The only one thing you should care about is memory leaks – but you can avoid memory leaks as explained later.

He starts by walking through some of the basics of creating a new instance of the class and loading the content (either as a string or as a file) to be parsed. He then give several examples of how to query the contents of the document and locate multiple or single elements (including the use of CSS-type selectors for fuzzy attribute matching). He finishes out the post showing how to access element attributes and append content back to the original HTML.

tagged: simpledom parser script tutorial introduction html dom

Link: https://www.codediesel.com/php/php-simple-html-dom-parser-script/


NetTuts.com:
Authentication and Authorization Using Auth0 in PHP
Jun 20, 2018 @ 11:16:08

The NetTuts.com site has posted a tutorial for those looking to simplify the authentication of users in their PHP applications. In this new article they show how to use the Auth0 service to offload some of the burden of user management and authentication flow.

In this article, we're going to explore the Auth0 service, which provides authentication and authorization as a service. Auth0 allows you to set up basic authentication and authorization features for your apps in the blink of an eye.

The article starts with a brief overview of what the Auth0 service offers and what particular ones will be involved in the tutorial. To help make it simpler to get up and running, they've created a base application. They show how to get this application installed and configured to use the secrets values from your Auth0 account. It then walks through the various scripts included in the sample application including a login, logout and code to perform the actual authentication flow process (including validating the access token).

tagged: authentication auth0 tutorial application authorization

Link: https://code.tutsplus.com/tutorials/authentication-and-authorization-using-auth0-in-php--cms-31134

Exakat Blog:
5 usages of static keyword in PHP
Jun 20, 2018 @ 10:28:21

On the Exakat blog there's a new post sharing five uses of the "static" keyword in PHP applications. This includes the less common static closures and static class names.

Static is a PHP keyword with many usages. It is almost universally used, though there are many variations of it. Let’s review all the five of them :
  • static method
  • static property
  • static closure
  • static variable
  • static as a classname

The post goes through each of the items in the list giving a brief explanation of how it's used and a code example showing it in action. The post finishes with some tips on evaluating your own code for the use of "static" and tips for each to make your code easier to wrangle and maintain in the future.

tagged: static keyword example tutorial method property closure variable classname

Link: https://www.exakat.io/5-usages-of-static-keyword-in-php/

Rob Allen:
Dependency Injection with OpenWhisk PHP
Jun 20, 2018 @ 09:55:13

Rob Allen has continued his series of posts covering the use of PHP on the OpenWhisk platform. In his latest tutorial he shows how to use dependency injection for use in "non-trivial PHP applications".

Any non-trivial PHP applications use various components to do its work, from PDO though to classes from Packagist. It’s fairly common in a standard PHP application to use Dependency Injection to configure and load these classes when necessary. How do we do this in a serverless environment such as OpenWhisk?

This question comes up because we do not have a single entry point into our application, instead we have one entry point per action. If we’re using Serverless to write an API, then we probably

He uses a common connection type - PDO to a database - to illustrate a method for injecting dependencies in a serverless application. In his example, he starts with a simple script that returns a set of "todo" items from the database (with the PDO connection code embedded in it). Using dependency injection is a better way to manage that PDO connection so he shows how to update it to use the Pimple DI container and inject it via the constructor to make it available to the rest of the application.

tagged: dependency injection serverless openwhisk tutorial pdo database

Link: https://akrabat.com/di-with-openwhisk-php/


Community News:
Latest PECL Releases (06.19.2018)
Jun 19, 2018 @ 08:05:01

Latest PECL Releases:

  • ibm_db2 2.0.6
    Fixed crash while in windows.

  • swoole 4.0.0
    - Using c stackful coroutine - Allow to create server in multiple processes - Fixed issue where http2 server could not send more than 16K data to Chrome browser client - Added Channel->peek method for peeping data - Fixed issue where Server->pause/resume could not be used under SWOOLE_PROCESS - Removed Linux AIO and use thread pool for asynchronous file IO anyway - Added MySQL stored procedure supports
tagged:

Link: