PHP Icon

PHP

PHP is a scripting language that works particularly well for server-side web development.
46 Stories
All Topics

PHP github.com

A completely open source ngrok alternative

Expose is a beautiful, open source, tunnel application that allows you to share your local websites with others via the internet.

Since you can host the server yourself, you have full control over the domains that your shared sites will be available at. You can extend expose with additional features and middleware classes on the server and client side, to make it suit your specific needs.

Alan Shreve closed ngrok’s source code years ago, and every now-and-again an open source alternative pops on the scene. Add Expose to the list. It’s written in PHP and has a nice shine on it. But which of these SSH tunneling tools is best in class?

A completely open source ngrok alternative

Go github.com

A high-performance PHP app server, load balancer, and process manager

RoadRunner is an open source (MIT licensed), high-performance PHP application server, load balancer and process manager. It supports running as a service with the ability to extend its functionality on a per-project basis.

RoadRunner is written in Go, and can be used to replace the class Nginx+FPM setup, boasting “much greater performance”. I’d love to see some benchmarks. Better yet, I’d love to see someone use this in production for a bit and write up their experience.

Go changelog.com/posts

Generate 4 language bindings for your API in one Go

You just built an API, and want to make sure everyone can use it. Building libraries in every language isn’t only going to be hard, its going to take a lot of time. Time you don’t have. This is where Alpaca can help.

You define your API according to the format, alpaca builds the API libraries along with their documentation. All you have to do is publishing them to their respective package managers.

Right now it can generate API clients in PHP, Python, Ruby, and JavaScript. You can see examples of the generated client libraries here. I can’t speak to the quality of all the generated language bindings, but I took a cursory look at the Python lib and it looks good. Looks like Alpaca could save us all a lot of time.

PHP changelog.com/posts

PredictionIO, a machine learning server for software developers and data engineers.

Want to add personalization such as recommendations or content discovery to your application? PredictionIO has your back.

You can download and install the server yourself or use their cloud infrastructure. Clients already exist for Java, PHP, Python, and Ruby, and I assume more are on the way.

Check out all of their open source goods right here.

PHP changelog.com/posts

Meet Boris, a tiny REPL for PHP

Chris Corbyn was frustrated with PHP’s lack of a good REPL, so he took matters into his own hands and created Boris. I can relate to Chris’s experience. Back when I used to write WordPress plugins I got so frustrated by the lack of a Rails-like interactive console that I created one for WordPress.

Boris is cooler than my little plugin because it works outside of WordPress and runs directly in your terminal. Check it out in action:

You can install Boris via Packagist or use it directly by cloning the repo:

git clone git://github.com/d11wtq/boris.git
cd boris
./bin/boris

This and much more information about the REPL is available in the README. Boris is MIT licensed and hosted on GitHub.

JavaScript changelog.com/posts

Bring your server side debug logging into the browser with Chrome Logger

If you find yourself jumping back and forth between Chrome’s Dev Tools and a terminal displaying your server side request logs, Craig Campbell’s Chrome Logger might be just the thing you need!

It’s a Chrome extension which lets you see your server side logs right in the browser. There are currently libraries for:

Is your server side language/environment of choice not on that list? Don’t worry, Chrome Logger uses an open and published protocol so you can easily write client libraries of your own!

See the project’s home page for more info or check under the hood if you’re curious about how it all works.

PHP changelog.com/posts

Requests - HTTP library for PHP

Higher level libraries for dealing with HTTP are cropping up in almost every language. The latest is Requests, a PHP library from Ryan McCue. Inspired by Kenneth’s Python library of the same name, Requests aims to provide a better HTTP API than cURL:

$headers = array('Accept' => 'application/json');
$options = array('auth' => array('user', 'pass'));
$request = Requests::get('https://api.github.com/gists', $headers, $options);

var_dump($request->status_code);
// int(200)

var_dump($request->headers['content-type']);
// string(31) "application/json; charset=utf-8"

var_dump($request->body);
// string(26891) "[...]"

I’ve written about my thoughts on what makes a good API wrapper and libraries like these that provide a more idiomatic experience are just great.

Grab Requests on GitHub.

PHP changelog.com/posts

Imagine - Unified PHP 5.3 API for GD2, ImageMagick, GraphicsMagick

Imagine is a nice looking image manipulation library for PHP 5.3+ that supports GD2, ImageMagick, and GraphicsMagick in a clean, chainable API from Bulat Shakirzyanov:

<?php

$imagine = new ImagineGdImagine();
// or
$imagine = new ImagineImagickImagine();
// or
$imagine = new ImagineGmagickImagine();

$size    = new ImagineImageBox(40, 40);

$mode    = ImagineImageImageInterface::THUMBNAIL_INSET;
// or
$mode    = ImagineImageImageInterface::THUMBNAIL_OUTBOUND;

$imagine->open('/path/to/large_image.jpg')
    ->thumbnail($size, $mode)
    ->save('/path/to/thumbnail.png')
;

Check out the extremely detailed project docs and examples for advanced usage.

PHP changelog.com/posts

Options-Framework: Expose an options panel for your Thematic WordPress themes

I don’t always use WordPress, but when I do, I prefer Thematic (and compass-wordpress). Thematic is a WordPress theme framework from Ian Stewart that provides an abstracted API, letting you focus on your site instead of the lower-level minutia of WordPress.

I was excited when I stumbled across a couple of projects by Devin Price that let you easily expose an options panel for your theme. Thematic Options (and the non-Thematic Options Framework) make it easy to add an options panel for your theme settings, letting your end users customize your theme in the WordPress admin panel.

screenshot

Options are declared in a PHP array, as in this example:

// Set the Options Array
global $my_options;
$my_options = array();

$my_options[] = array( "name" => "General Settings",
                    "type" => "heading");

$my_options[] = array( "name" => "Custom Logo",
          "desc" => "Upload a logo for your theme, or specify the image address of your online logo. (http://yoursite.com/logo.png)",
          "id" => "logo",
          "std" => "",
          "type" => "upload");

$url =  ADMIN . 'images/';
$my_options[] = array( "name" => "Main Layout",
          "desc" => "Select main content and sidebar alignment. Choose between 1, 2 or 3 column layout.",
          "id" => "layout",
          "std" => "2c-l-fixed.css",
          "type" => "images",
          "options" => array(
            '1col-fixed.css' => $url . '1col.png',
            '2c-r-fixed.css' => $url . '2cr.png',
            '2c-l-fixed.css' => $url . '2cl.png',
            '3c-fixed.css' => $url . '3cm.png',
            '3c-r-fixed.css' => $url . '3cr.png')
          );
$my_options[] = array( "name" => "Custom Favicon",
          "desc" => "Upload a 16px x 16px Png/Gif image that will represent your website's favicon.",
          "id" => "custom_favicon",
          "std" => "",
          "type" => "upload"); 

$my_options[] = array( "name" => "Tracking Code",
          "desc" => "Paste your Google Analytics (or other) tracking code here. This will be added into the footer template of your theme.",
          "id" => "google_analytics",
          "std" => "",
          "type" => "textarea");

...

Devin has a nice blog post with more info including how to use these values in your theme, along with an introductory screencast.

[Source on GitHub]

0:00 / 0:00