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

North Meets South Podcast:
Episode #28 - Eloquent observers, managing client expectations, and Larav
May 23, 2017 @ 11:32:26

In the most recent episode of the North Meets South podcast - Episode #28 - hosts Jacob Bennett and Michael Dyrynda talk about Laravel. More specifically they cover Eloquent functionality, client expectations, and packages.

In this episode, Jake and Michael talk about Eloquent observers and answer listener questions about managing client expectations and packages we use in our Laravel applications.

Other topics mentioned in this episode include Dash (the documentation tool), the "Supercharge Your Tinker Workflow" article and the Sentry package for Laravel. You can listen to this latest show either using the in-page audio player or by downloading the mp3 directly 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 shows are released.

tagged: northmeetssouth podcast ep28 eloquent observer client expectations laravel package

Link: http://www.northmeetssouth.audio/28

Symfony Blog:
The new Symfony 3.3 Service Configuration Changes Explained
May 23, 2017 @ 10:15:27

On the Symfony blog, there's an article posted by Ryan Weaver helping to explain the new service configuration changes that are included with version 3.3 of the framework.

In less than 2 weeks, Symfony 3.3 will be released. It comes with a lot of new stuff, but there is one feature that stands out: the new service configuration. I am very excited about these changes: they're designed to accelerate development, make Symfony easier to learn and encourage best-practices (e.g. injecting specific dependencies instead of using $container->get())... without sacrificing predictability and stability.

The post includes an example of what the new configuration file format will look like and briefly explains some of the changes. For those interested in a more in-depth look, they also link to this page in the Symfony documentation that goes through the changes step by step. It covers the autowiring by default, autoload of services, controllers being registered as services and more. If you're planning on making the move up to v3.3 when it's released (or sometime after) definitely check out this guide to make the transition easier.

tagged: symfony framework service configuration changes explained documentation

Link: http://symfony.com/doc/master/service_container/3.3-di-changes.html

Stitcher.io:
PHP Generics and why we need them
May 23, 2017 @ 09:48:56

On the Stitcher.io blog there's a post that's advocating the addition of a feature to the core PHP language that several others have: generics. The basic idea behind generics is to provide functionality that allows the definition of entity types that can be reused as a default (like a "collection" generic that could be used instead of a base collection class).

In today's blog post we'll explore some common problems with arrays in PHP. All the problems and issues listed could be solved with a pending RFC which adds generics to PHP. We won't explore in too much detail what generics are. But at the end of this read, you should have a good idea as to why they are useful, and why we really want them in PHP. So without further ado, let's dive into the subject.

They start off with a common use case in PHP: a collection of blog posts and getting information from them. There's no guarantee that the contents of the set are always post objects leading to specific checks to ensure data quality before use. The post then uses a common example from PHP, the creation of a collection class to handle a set of objects and then showing how (with pseudo-code as generics aren't in the language) how that same functionality might look defined as a generic collection instead.

tagged: generics language feature example rfc collection

Link: https://www.stitcher.io/blog/php-generics-and-why-we-need-them

Community News:
Latest PECL Releases (05.23.2017)
May 23, 2017 @ 08:05:01

Latest PECL Releases:

  • pdo_sqlsrv 4.2.0preview
    [Added]

    • Added support for sql_variant data type with limitation ([issue #51] and [issue #127])
    • This is a preview for Debian Jessie (tested on Debian 8.7) [Fixed]
    • Increased Test Coverage
    • General bug fixes after running static analyses [Limitation]
    • Limited support for input / output params when using sql_variant [Known Issues]
    • User defined data types
    • When pooling is enabled in Linux or MAC
      • unixODBC 2.3.4 or prior (Linux and MAC) might not return proper diagnostics information, such as error messages, warnings and informative messages
      • due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples (https://github.com/Microsoft/msphpsql/wiki/Connection-Pooling-on-Linux-and-Mac)
  • sqlsrv 4.2.0preview
    [Added] - Added support for sql_variant data type with limitation ([issue #51] and [issue #127]) - This is a preview for Debian Jessie (tested on Debian 8.7) [Fixed] - Increased Test Coverage - General bug fixes after running static analyses [Limitation] - Limited support for input / output params when using sql_variant [Known Issues] - User defined data types - When pooling is enabled in Linux or MAC - unixODBC 2.3.4 or prior (Linux and MAC) might not return proper diagnostics information, such as error messages, warnings and informative messages - due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples (https://github.com/Microsoft/msphpsql/wiki/Connection-Pooling-on-Linux-and-Mac)
tagged:

Link:

Building Your Startup:
Securing an API
May 22, 2017 @ 13:16:19

The TutsPlus.com site has continued their "Building Your Startup" tutorial series with a new post about APIs and security. In this series, they've been using the Yii2 framework to create a calendaring "startup" site. Now they're to the point of adding a "RESTful" API to the system and want to be sure it's secure.

Recently, I introduced you to Yii's simple REST API generation and Meeting Planner's new "RESTful" service API. At that time, I mentioned that these APIs were only loosely secured. Sure, there was a shared secret between the client and the server, but there were a couple of problems.

First, the secret key and user tokens were repeatedly transmitted in query parameters of SSL calls. And there was no other authenticity check for the data, allowing a middle-person attack. In today's episode, I'll guide you through how I secured the API against these weaknesses for a more robust API.

They start off looking at the API security that was previously put in place using an "app ID" and "app secret" values to identify the user. To improve on this, the system is updated to use the "app secret" value to sign the outgoing data via a HMAC hash that is sent along with the request.

tagged: api security tutorial yii2 build startup series hmac rest

Link: https://code.tutsplus.com/tutorials/building-your-startup-securing-an-api--cms-27867

Voices of the ElePHPant:
Interview with Michelangelo van Dam (#3)
May 22, 2017 @ 12:24:15

The Voices of the ElePHPant podcast, hosted by Cal Evans has posted their latest episode with an interview of a member of the PHP community. In this latest show Cal talks with Michelangelo van Dam, a well-known PHP conference speaker and organizer of PHP Benelux.

They talk about why Michelangelo speaks at conferences and what he gets out of both presenting and being at the events. They also talk about conferences in general and, more specifically, the Lone Star PHP Conference (having had their last one this year, 2017). They also talk about the PHP Benelux conference, what they try to provide to their attendees and sponsors and how cultural differences play a part.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for updates when the latest shows are released.

tagged: voicesoftheelephpant community interview podcast michelangelovandam calevans

Link: https://voicesoftheelephpant.com/2017/05/16/interview-with-michelangelo-van-dam-3/

SitePoint PHP Blog:
Re-Introducing Composer – the Cornerstone of Modern PHP Apps
May 22, 2017 @ 11:54:48

If you've been developing any kind of PHP applications lately, chances are you've at least heard of Composer. This package manager has dramatically changed the way we develop in PHP but there are still some out there wondering what all the fuss is about. In this tutorial from SitePoint author Claudio Ribeiro (re-)introduces this powerful tool and provides some basics of its use.

In this article, we will tackle the basics of Composer, and what makes it such a powerful and useful tool.

Before we go into detail, there are two things that we need to have in mind: what Composer is [and] what Composer is not. [...] Essentially, Composer allows you to declare and manage every dependency of your PHP projects.

He then walks you through the installation of the tool, running it either globally or locally (per-project). He lists out some of the basic commands, what they're for and helps you on your way to installing your first package: PHPUnit. He also covers the special "vendor" folder Composer creates, how autoloading works, various configuration values and installing packages globally rather than just locally. He then talks about the other side of the PHP package ecosystem: Packagist including how to submit packages and set up your own package's composer.json so it can be pulled in correctly.

tagged: composer introduction basics tutorial package packagist

Link: https://www.sitepoint.com/re-introducing-composer/

Dotkernel.com:
What is PSR-7 and How to Use It
May 22, 2017 @ 10:18:50

On of the standards that have come out of the PHP-FIG (PHP Framework Interoperability Group) in the past few years has been PSR-7, a standards definition for working with HTTP requests and responses as PHP objects. While those that have worked with most of the PHP frameworks out there may be familiar with the concept, it can be confusing if you're just getting started with the idea. In this post on the Dotkernel site they introduce PSR-7, talking about its goals and what it defines to help bring everyone on the same page for HTTP requests.

PSR-7 is a set of common interfaces defined by PHP Framework Interop Group. These interfaces are representing HTTP messages, and URIs for use when communicating trough HTTP.

Any web application using this set of interfaces is a PSR-7 application.

They start off by defining (and linking to) the different interfaces involved in the PSR-7 specification (the spec doesn't define functionality, only the structure). From there the tutorial uses the Zend Diactoros component to illustrate an implementation of the PSR-7 structure. They cover two of the main tasks when working with HTTP requests/responses: working with the headers and fetching/writing to the body.

tagged: psr7 phpfig standard http request response introduction

Link: https://www.dotkernel.com/dotkernel3/what-is-psr-7-and-how-to-use-it/

Rob Allen:
Inserting binary data into SQL Server with ZF1 & PHP 7
May 22, 2017 @ 09:34:51

In an interesting mix of "old" and "new" Rob Allen as shown in this new post to his site how to push binary data into a SQL Server database from a Zend Framework v1 application.

If you want to insert binary data into SQL Server in Zend Framework 1 then you probably used the trick of setting an array as the parameter's value with the info required by the sqlsrv driver as noted in Some notes on SQL Server blobs with sqlsrv.

[...] Working through the problem, I discovered that this is due to Zend_Db_Statement_Sqlsrv converting the $params array to references with this code. The Sqlsrv driver (v4) for PHP 7 does not like this! As Zend Framework 1 is EOL, we can't get a fix into upstream and update the new release, so we have to write our solution.

He includes the code for the "hack" that you'd normally have to do to push the binary data into the database. Zend Framework v1 is EOL (end of life) so the Zend_Db_Statement_Sqlsrv class can't be updated. Instead, he writes his own replacement, creating a new adapter specific to the application that handles the input as the SQL Server driver is expecting. He then updates the application configuration to force the new adapter to be used when the ZF1 application needs to connect to the SQL Server database.

tagged: insert binary data sqlserver zendframework php7 tutorial adapter

Link: https://akrabat.com/inserting-binary-data-into-sql-server-with-zf1-php-7/

Community News:
Latest PEAR Releases (05.22.2017)
May 22, 2017 @ 08:05:01

Latest PEAR Releases:

tagged:

Link: