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

Oh Dear Blog:
Our Gitlab CI pipeline for Laravel applications
Dec 18, 2018 @ 17:14:53

On the "Oh Dear!" blog they've written up a post sharing the Gitlab continuous integration pipeline they use for the deployment of the application. While, in their case, it's a Laravel-based application, the basics of it could be used for just about any PHP application with slight modifications.

We've been fairly public about the amount of testing we have for Oh Dear!. Freek has been showing bits and pieces on his Twitter to show the extent of that effort.

Having a huge test suite is nice, but integrating it into your development workflow is even better.

That's why we're releasing our Gitlab CI pipeline that is optimized for Laravel applications. It contains all the elements you'd expect: building (composer, yarn & webpack), database seeding, PHPUnit & copy/paste (mess) detectors & some basic security auditing of our 3rd party dependencies.

The post starts with an overview of their pipeline flow (including a graphic) showing the different stages and the steps involved in each. It then moves on to the setup of Gitlab's CI functionality using a local Gitlab runner to run the pipeline. It covers some of the issues around CPU load using Docker. Next it shares the configurations for the different stages in the flow and decisions they had to make around building assets, dependencies and caching.

tagged: tutorial laravel application gitlab gitlabci continuous integration setup pipeline

Link: https://ohdear.app/blog/our-gitlab-ci-pipeline-for-laravel-applications

Jeff Ochoa:
Understanding Laravel Pipelines
Aug 29, 2017 @ 15:59:36

On his Medium blog Jeff Ochoa has written up a tutorial that want to help you understand pipelines in Laravel, a fluid interface that can be used to pass objects around.

Basically, using laravel pipelines you can pass an object between several classes in a fluid way to perform any type of task and finally return the resulting value once all the “tasks” have been executed.

[...] The most clear example about how pipelines works resides in one of the most used components of the framework itself. I’m talking about middlewares.

He uses a simple middleware as an example, covering how they're just "pipes" in the pipeline of execution. He includes a snippet of code from the Illuminate handling showing its place in the pipeline and gives a more real world example of commenting functionality with a few different pieces of functionality. He shows how this could be refactored into the pipeline handling and what happens at the end of the pipe.

tagged: laravel pipeline introduction tutorial pipe example

Link: https://medium.com/@jeffochoa/understanding-laravel-pipelines-a7191f75c351

Zend Framework Blog:
Using Configuration-Driven Routes in Expressive
Apr 05, 2017 @ 17:21:26

The Zend Framework blog continues their series of posts looking at the Zend Expressive framework with this latest tutorial showing you how to use configuration-driven routing instead of routes defined in just code.

Expressive 1 used configuration-driven pipelines and routing; Expressive 2 switches to use programmatic pipelines and routes instead. The programmatic approach was chosen as many developers have indicated they find it easier to understand and easier to read, and ensures they do not have any configuration conflicts.

However, there are times you may want to use configuration. For example, when you are writing re-usable modules, it's often easier to provide configuration for routed middleware, than to expect users to cut-and-paste examples, or use features such as delegator factories.

Fortunately, starting in Expressive 2, we offer a couple different mechanisms to support configuration-driven pipelines and routing.

They start by pointing out the result of the Expressive v1 to v2 migration tool (enabling v2's pipeline handling) and a warning that there could be issues as the programmatic declarations still remain. The tutorial then gets into some of the drawbacks of going configuration-only but shows how, with just a bit of extra code, those can be someone relieved. An example is included showing a configuration provider that, from the functionality itself, defines the routes and injects them into the current application (using injectRoutesFromConfig).

tagged: zendframework zendexpressive configuration route pipeline migration provider tutorial

Link: https://framework.zend.com/blog/2017-03-30-expressive-config-routes.html

Zend Framework Blog:
Nested Middleware in Expressive
Mar 16, 2017 @ 16:52:21

On the Zend Framework blog Matthew Weier O'Phinney has posted another tutorial, this time showing you how to use nested middleware in Expressive allowing for the composition of your own workflow in the request/response flow.

A major reason to adopt a middleware architecture is the ability to create custom workflows for your application. Most traditional MVC architectures have a very specific workflow the request follows. While this is often customizable via event listeners, the events and general request lifecycle is the same for each and every resource the application serves.

With middleware, however, you can define your own workflow by composing middleware.

He starts by describing one of the main concepts in the workflow of the application: pipelines. He gives an example of the default pipeline included with the Expressive skeleton application and how the middleware it uses nests to create a custom logic and handling flow. He follows this with an example scenario showing how to add authentication into the pipeline, specifically the use of Digest authentication via a PSR7 middleware package. Code is included for the integration of this package and the end result - all pages requiring authentication. He shows how to modify this and limit it to only certain paths and how to nest them in the route definitions.

Finally he shows another approach - creating a custom middleware pipeline inside of the factory for the requested middleware. He also covers nested applications, using traits for common workflows and the use of "delegator factories".

tagged: expressive tutorial nested middleware pipeline custom authentication example

Link: https://framework.zend.com/blog/2017-03-15-nested-middleware-in-expressive.html

Fabian Schmengler:
Collection Pipelines in PHP
Dec 28, 2016 @ 18:24:24

In a new post to his site Fabian Schmengler has written up an introduction to collection pipelines and how it could be applied to a Magento-based environment.

If you read the book “Refactoring to Collections” or saw screencasts and talks by Adam Wathan about collection pipelines, but do not work with Laravel, you might have asked yourself how to apply these techniques to other PHP applications, for example Magento.

[...] This is very similar to Unix pipes, where the individual commands are the operations, and the lines passed through input and output stream, the collection.

He starts by illustrating the idea in Bash and Ruby, showing the three main types of collection operations: map, filter and reduce. He talks about the advantages these methods have over traditional looping and what kind of value they can provide in both Laravel and plain old PHP. He illustrates the PHP-only versions using the array_filter, array_map and array_reduce functions and some thoughts on when it's good to use them over normal looping (and when it's not). He then gets into the Magento-specific handling and making use of a package to handle collections: Knapsack. He shows how to use the library to work with collections and, as another option, a "home-grown" version that lives in a single class. The post wraps up with the Magento integration of this functionality, a brief mention of functional programming and "the hard part" of issues with debugging.

tagged: collection pipeline package knapsack magento integration tutorial introduction map reduce filter

Link: https://www.schmengler-se.de/en/2016/12/collection-pipelines-in-magento/

Ben Ramsey:
Building PHP Projects on AWS CodeBuild
Dec 05, 2016 @ 16:54:48

Ben Ramsey has a post to his site sharing the process he's worked up to deploy PHP applications on AWS Codebuild, a new service from Amazon Web Services that fills the niche for an easy to spin up and use build server.

The main highlight of re:Invent is always the keynotes and the new services and features announcements they make during the keynotes. One of the new services caught my attention, and I decided to give it a try. That service is AWS CodeBuild.

CodeBuild is designed to be used as part of the AWS CodePipeline, but it may also be used by itself. [...] Out of the box, CodeBuild provides some managed images that you may use to build your projects. These include environments for Android, Java, Python, Ruby, Golang, and Node.js. PHP is missing from this list, but since you’re able to use other images, I decided to see how easy it is to get up and running on CodeBuild with a PHP project. I chose to try out my ramsey/uuid library for a simple test.

He walks you through the creation of a new CodeBuild instance (complete with screenshots of the UI) and how to configure your project, explaining each of the settings as he goes. He includes the full build command he's using for the library running tests, a lint check and codesniffer checks for formatting. He shows how to get the project to build and what the UI will show when the build is successful (all green).

tagged: project aws codebuild pipeline library tutorial setup build server amazon

Link: https://benramsey.com/blog/2016/12/aws-codebuild-php/

Chris Jones' Blog:
Speeding up DBMS_OUTPUT in PHP OCI8
Oct 27, 2008 @ 13:48:59

In this new post to his Oracle blog, Chris Jones shows how to set up DBMS_OUTPUT to work with the OCI8 extension available for PHP.

Immediately after OOW, Alison and I have got straight into updating the Underground PHP & Oracle Manual. We've had our heads right down. [...] When reviewing the DBMS_OUTPUT section I tried using a PIPELINED PL/SQL function and found a significant speed improvement over the basic method.

He shows a few different methods for getting it working and includes both the code, SQL to create the functions and a bit of stats at the end showing which method is the fastest (the pipelined version wins out by quite a bit every time).

tagged: pipeline oci8 dbmsoutput function tutorial statistics

Link:

H3rald.com:
Rails-inspired PHP frameworks
May 05, 2006 @ 12:21:19

The H3rald site has posted a new article that looks at a collection of PHP frameworks that have been inspired by Rails' example.

There are various articles online examining many PHP frameworks, providing short reviews or comparative charts, but I could not find yet an article examining the so called "Rails-inspired frameworks" anywhere on the web, so I decided to write my own…

I'm talking about those PHP frameworks who give at least part of their success to Ruby on Rails2, but don't call them clones or ports as some of their creators may get offended.

He comments on how Rails' entrance into the world of the web was a "shocking" experience and how, as soon as developers saw the benefits of an easy to use "semi-sentient" web development framework, they jumped on board - including several PHP developers out there. To illustrate the point, he gives six PHP frameworks up as examples:

Under each example, there's a list of the license, size, databases supported, a tutorial, and a description of the framework (including the pros and cons of using it). He also includes a few comments on each with his personal opinions and a few extra facts thrown in.

tagged: rails inspired framework cakephp symfony phpontrax codeigniter pipeline rails inspired framework cakephp symfony phpontrax codeigniter pipeline

Link:

H3rald.com:
Rails-inspired PHP frameworks
May 05, 2006 @ 12:21:19

The H3rald site has posted a new article that looks at a collection of PHP frameworks that have been inspired by Rails' example.

There are various articles online examining many PHP frameworks, providing short reviews or comparative charts, but I could not find yet an article examining the so called "Rails-inspired frameworks" anywhere on the web, so I decided to write my own…

I'm talking about those PHP frameworks who give at least part of their success to Ruby on Rails2, but don't call them clones or ports as some of their creators may get offended.

He comments on how Rails' entrance into the world of the web was a "shocking" experience and how, as soon as developers saw the benefits of an easy to use "semi-sentient" web development framework, they jumped on board - including several PHP developers out there. To illustrate the point, he gives six PHP frameworks up as examples:

Under each example, there's a list of the license, size, databases supported, a tutorial, and a description of the framework (including the pros and cons of using it). He also includes a few comments on each with his personal opinions and a few extra facts thrown in.

tagged: rails inspired framework cakephp symfony phpontrax codeigniter pipeline rails inspired framework cakephp symfony phpontrax codeigniter pipeline

Link:

Community News:
The Pipeline Project (MVC-based Framework)
Jan 03, 2006 @ 13:02:08

Ryan Johnson over at the Pipline Project emailed in today to let us know about their project, Pipeline, an MVC-based framework that's targeting itself at "the little guy" sites out there.

The project is in its very early stages, and so we ask you to know that there will be more to come, and that this is just the first developer preview. However, we can stand behind it in our belief that it's a highly evolved specimen, and will be of interest to anybody developing web applications, or just writing about them. In the future we will be releasing commercial products under the Livepipe brand, but for now all of the work we are announcing today, or in the near future, will be released under the MIT license for all to enjoy.

You can grab the latest version (their first developer preview of Pipeline) from their download page, or check out their roadmap and blog for more...

tagged: framework mvc model view controller livepipe pipeline framework mvc model view controller livepipe pipeline

Link:


Trending Topics: