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

SitePoint PHP Blog:
My Laravel Package Building Workflow
Mar 20, 2017 @ 16:19:04

On the SitePoint PHP blog they've posted a tutorial from author Francesco Malatesta covering his Laravel package building workflow.

Packages are a really important part of the Laravel experience (just like with any other framework). Whatever we need to do, there’s probably already a package for it out there; ready for a composer require to bring some magic in.

Some weeks ago, I had an idea for a new one. I work for AdEspresso, where we have a Symfony FeatureBundle, which handles feature toggling in our projects. It’s a really nice piece of code that we use to release new features only for specific subsets of users. So, I asked myself… why not port it for Laravel? That’s how my Laravel Feature package idea was born.

[...] In this article, I will try to explain how I prepared my development environment for it, and which choices I made when building the package. Not the development of every line of code per-se, but the actual workflow of getting from nothing to a full package.

He starts by talking about a handy addition to an application that can make the rollout of your new package easier: feature flags. He then starts in talking about the Composer configuration of the package and its "skeleton" (default directory and file structure). The tutorial then starts in on the code in the package itself covering the abstraction of domain code and implementing the features including the configuration, Blade template and the matching facade.

tagged: laravel package workflow tutorial skeleton featureflag implementation

Link: https://www.sitepoint.com/laravel-package-building-workflow/

Alfred Nutile:
Feature Flags In Laravel
Jan 26, 2016 @ 15:45:02

In a post to his site Alfred Nutile has posted a guide to integrating feature flags (toggles) into your Laravel-based application to show and hide features based on different criteria. He makes use of the Atriedes/feature library to handle some of the logic and decisions for him.

We are working on using FeatureFlags or Toggles in our applications. For one we are aiming to do all our work on mainline branch at all times so this would be a key coding discipline to use FeatureFlags so we can hide a feature in progress knowing it will not interfere with the application.

[...] One key thing, as I use this in Laravel, is I will try and mix this with the existing Authorization workflow that is already present. This gives me some already prepared ways to think about this both at the view layer, model layer and controller layer and where to register these states.

He shows how to get the "feature" library installed and integrates it with the Laravel application via two service providers: one for the core flag handling and the other for defining the policies themselves. He includes the code for each of these providers and makes some simple "can see" and "can add" policies for a Twitter field. He also shows the code for the evaluation methods and how to make use of the functionality in a menu (template). He also includes a screencast showing how it all works in a live application.

tagged: featureflag toggle tutorial laravel atriedes library screencast feature

Link: https://alfrednutile.info/posts/175


Trending Topics: