Quantcast
Channel: php – Bram.us
Browsing all 166 articles
Browse latest View live

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 Article


hashids

$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 Article


PropelORM

<database name="default"> <table name="book"> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/> <column name="title" type="varchar"...

View Article

Transducers 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 Article

Image may be NSFW.
Clik here to view.

PHP 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 Article


Deployment 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 Article

Image may be NSFW.
Clik here to view.

PHP 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 Article

Image may be NSFW.
Clik here to view.

Recommended 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 Article


Image may be NSFW.
Clik here to view.

StackPHP – 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 Article


Image may be NSFW.
Clik here to view.

PHP 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 Article

Image may be NSFW.
Clik here to view.

Getting 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 Article

Image may be NSFW.
Clik here to view.

Extract 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 Article

Sublime 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 Article


PHP 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 Article

Image may be NSFW.
Clik here to view.

OwnYourGram

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 Article


Carbon – 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 Article

Scrapbook, 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 Article


Image may be NSFW.
Clik here to view.

Typed 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 Article

Image may be NSFW.
Clik here to view.

Laravel 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 Article

Image may be NSFW.
Clik here to view.

Simple 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
Browsing all 166 articles
Browse latest View live


Latest Images