ANSI Control Functions and ANSI Control Sequences (Colors, Erasing, etc.) for...
A side project for Monolog Colored Line Formatter (which itself also is a side project for Mixed Content Scan) I just published is ANSI PHP. bramus/ansi-php is a set of classes to working with ANSI...
View Articlehashids
$hashids = new Hashids\Hashids('this is my salt'); $id = $hashids->encode(1, 2, 3); $numbers = $hashids->decode($id); Hashids is a small open-source library that generates short, unique,...
View ArticlePropelORM
<database name="default"> <table name="book"> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/> <column name="title" type="varchar"...
View ArticleTransducers in PHP
use Transducers as t; $xf = t\comp( t\drop(2), t\map(function ($x) { return $x + 1; }), t\filter(function ($x) { return $x % 2; }), t\take(3) ); $data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; $result =...
View ArticlePHP Scalar Type Hints
At this moment a vote on the PHP RFC “Scalar Type Hints” is going on. It would allow stuff like this: <?php class ElePHPant { public $name, $age, $cuteness, $evil; public function...
View ArticleDeployment with Envoy
// Contents of Envoy.blade.php @servers(['web' => 'deploy-ex']) <?php $repo = 'git@github.com:Servers-for-Hackers/deploy-ex.git'; $release_dir = '/var/www/releases'; $app_dir = '/var/www/app';...
View ArticlePHP Scalar Type Hints, Follow-up
The vote for the RFC “PHP Scalar Type Hints” got cancelled, after the author of the RFC – Andrea Faulds – posted “I Quit” on the internals list: For my own reasons, I have decided to cease my...
View ArticleRecommended Reading: Modern PHP
PHP is experiencing a renaissance, though it may be difficult to tell with all of the outdated PHP tutorials online. With this practical guide, you’ll learn how PHP has become a full-featured, mature...
View ArticleStackPHP – HttpKernelInterface based middlewares
The HttpKernelInterface models web request and response as PHP objects, giving them value semantics. Stack is a convention for composing HttpKernelInterface middlewares. By wrapping your application...
View ArticlePHP RFC: Short Closures (Arrow Functions)
New RFC proposing Short Closures (better known as “Arrow Functions” in other languages). As ->, and => are already in use, ~> is proposed: $x ~> $x * 2 $x ~> { return $x * 2;} ($x)...
View ArticleGetting Ready for PHP 7
When PHP 5.6 was snooping around the corner I prepared this “Getting Ready for PHP 5.6” post to get one started with the new things that made it into the language. Now that PHP 7 is in beta, it’s time...
View ArticleExtract Till You Drop
Under the pressure of deadlines and endless change requests, under the weight of years of legacy, code becomes unmaintainable. With the right tools, techniques, and mindset, any codebase can be...
View ArticleSublime Text 3 for PHP Developers
I admit, I’m a Sublime Text user. Why? Because it’s an IDE that plays nice for a lot of languages. Using Sublime Text I can let my students – from the first year up until the third – write SQL...
View ArticlePHP Markdown
use \Michelf\Markdown; $my_html = Markdown::defaultTransform($my_text); This is a library package that includes the PHP Markdown parser and its sibling PHP Markdown Extra with additional features....
View ArticleOwnYourGram
OwnYourGram is a service which streams your Instagram photos to your own site in real-time. After signing in with IndieAuth, it sends your Instagram photos to your micropub endpoint. OwnYourGram →...
View ArticleCarbon – A simple PHP API extension for DateTime.
$carbon = new Carbon('first day of next week'); if ($carbon->isWeekend()) { echo 'Party!'; } echo $carbon->addYear()->diffForHumans(); // 'in 1 year' Carbon is just a class which is designed...
View ArticleScrapbook, PHP Caching Environment
// create \Memcached object pointing to your Memcached server $client = new \Memcached(); $client->addServer('localhost', 11211); // create Scrapbook cache object $cache = new...
View ArticleTyped Arrays in PHP
Tim Bezhashvyly: Typed arrays exist in PHP, at least to some degree. This wonderful feature sneaked in as a side-effect of variadic functions that were added to the language in PHP 5.6. Turns out one...
View ArticleLaravel Backup
If you’re a developer using Laravel I’d strongly recommend “Laravel Backup”, a package developed by the folks over at Spatie. Version 3 just got released: Laraval Backup can backup the files and...
View ArticleSimple PHP Valuestore Class
If you’re looking for a simple Value Store (you know: key-value) Freek and Jolita over at spatie has whipped up a simple class that does this for you. $valuestore = Valuestore::make($pathToFile);...
View Article