PHP Icon

PHP

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

PHP changelog.com/posts

Slim: A PHP5 Sinatra Clone

Screen shot

Frank Sinatra was the Chairman of cool. Some fourteen years after his death, the crooner is still imitated.

Just like its namesake, Sinatra, the class Ruby web application DSL still inspires all sorts of projects from Sammy.js to Padrino to Denied.

Slim, a PHP5 project from Josh Lockhart is the latest project to cover the classics.

Setup

To get started, just require the script and call init

<?php
require('slim/Slim.php');
Slim::init();
?>

Routing

Slim supports the familiar Sinatra-style routes for all four HTTP verbs:

Slim::get('/books/:id', function ($id) {
    //Do something
});

Slim::post('/books', function () {
    //Do something
});

Slim::put('/books/:id', function ($id) {
    //Do something
});

Slim::delete('/books/:id', function ($id) {
    //Do something
});

Middleware and callbacks

Slim also allows you to run code before and after your actions:

Slim::before(function () {
    //Do something
});


Slim::after(function () {
    //Do something
});

Templating

Slim supports a variety of templates including Smarty and Twig.

[Source on GitHub] [Hompage]

JavaScript changelog.com/posts

Snapbird - Twitter search on steroids

If you’ve ever spent time looking for a long lost tweet and have gotten frustrated by the short window that tweets are indexed by Twitter Search, then check out Snapbird from Remy Sharp of jQuery for Designers fame.

Snapbird lets you search someone’s timeline, favorites, or your own direct messages without the 7 day Twitter Search restriction. It even lets you permalink favorite queries.

Snapbird also uses Twitterlib, Remy’s JavaScript Twitter API wrapper.

Snapbird is open source so you can either use the hosted version or fork the project and run your own.

[Source on GitHub] [Homepage]

PHP changelog.com/posts

Phake: M/Rake for PHP

It’s always refreshing to see language communities learning from eachother. PHP now as its own clone of GNU Make and Ruby’s Rake: Phake.

Automation Ahoy!

Phake supports task grouping, before/after blocks, and task descriptions. Requires PHP >= 5.3 (for closures).

Here’s a simple task definiton:

task('dependency1', function() {
      echo "i will run first!n";
});

task('dependency2', function() {
  echo "i will run second!n";
});

task('task_name', 'dependency1', dependency2', function() {
      echo "i will run last!n";
});

And to run the task, simply:

./phake task_name

[Source on GitHub]

PHP changelog.com/posts

CoreyLib: PHP Universal API Wrapper

The PHP world is filled with API and XML Parsers that often bring page rendering to a crawl.

Aaron Collegeman’s CoreyLib library is an incredibly simple universal API wrapper with caching built in.

It can handle most modern APIs with full XML, JSON, authentication, parameterization, xmlNode, and Xpath support. All requests can be cached in MySql and parsed at a custom interval to dramatically improve page rendering speed.

Here’s all the code needed to get the latest 5 tweets from twitter:

Source on GitHub

PHP changelog.com/posts

Fiber: A simple PHP interface to CouchDB

Fiber from Luis Gomez is a simple way to add CouchDB storage to your PHP app.

Given a User class that extends a Fiber Document:

$user = User::find('john');
$user->email = "john@example.com";
$user->city = "San Francisco";
$user->save();

Fiber also includes some nifty chaining:

$user->set( array( "email" => "peter@example.com", "city" => "Caracas" ) )->save();

Check out the examples in the source.

[Source on GitHub]

PHP changelog.com/posts

storytlr - lifestreaming for geeks

Open Source has its own Circle of Life. As we discussed in Episode 0.1.1, Open Source creates opportunities for entrepreneurs. Sometimes those businesses can spin off their own projects, paving the way for the next round of startups.

Sometimes commercial apps just don’t survive, but let’s not confuse viable with valuable. Take the case of Storytlr, a hosted lifestreaming service which sought to let you remix your social networking interactions into your own “stories.” When the hard decision was made to pull the plug on the service at the end of last year, the founders did what many apps have done and handed the source code over to the community.

The official Storytlr open source project is on Google Code but John Hobbs has a fork on GitHub that adds:

  • A tool to rename users (dangerous if not handled properly)
  • Plugins built in for…
  • Github
  • goodreads
  • Foursquare
  • Stack Overflow
  • Twitter favorites
  • Google Buzz
  • Ability to delete items that are from other sources (not just ones from Storytlr itself)
  • tidy is replaced by htmLawed
  • Misc fixes for issues reported on the Google group
  • Misc fixes from other forks, esp. paths courtesy of Stuart Herbert

For a live demo, check out @abraham’s Storytlr at http://stream.abrah.am/.

Storytlr runs on PHP (which runs darn near everywhere) and installation instructions can be found in the README.

[Official Google Code Project] [Source on GitHub]

PHP changelog.com/posts

riak - high performance document store built on JSON and REST

riak
Riak, REE-ahk, combines the power of Erlang with the ubiquity of JSON to deliver a highly scalable document store over REST. Hold on CouchDB fans, before you pounce, you haven’t heard this one before.

Master-less replication

Riak is architected for master-less replication from the GET-go. All nodes participate equally in the replication so scaling horizontally means just adding new servers to join the party.

Links for powerful object graphs

Riak supports link-walking which is far more powerful than traditional relational DB joins. As Sean Cribbs explains:

Every datum stored in Riak can have one-way relationships to other data via the Link HTTP header. In the canonical example, you know the key of a band that you have stored in the “artists” bucket (Riak buckets are like database tables or S3 buckets). If that artist is linked to its albums, which are in turn linked to the tracks on the albums, you can find all of the tracks produced in a single request. As I’ll describe in the next section, this is much less painful than a JOIN in SQL because each item is operated on independently, rather than a table at a time. Here’s what that query would look like:
GET /raw/artists/TheBeatles/albums,_,_/tracks,_,1

More powerful Map/Reduce

Map/Reduce works a bit differently in Riak. Riak’s Map function expects a list of keys on which it should run. You can of course pass every key in your bucket, but doing Map in this way allows Map to be run on the node where the data is actually stored.

Riak ships with libraries for Python, Ruby, Java, Erlang, and even JavaScript. Want to know more? Stay tuned. Riak will be the focus of an upcoming episode of The Changelog.

[Source on BitBucket] [Homepage] [Brian Fink’s NYC-NoSQL talk]

PHP changelog.com/posts

Facebook's HipHop leaves PHPers dancing

When Twitter faced early scaling issues, much was made of decisions to rewrite large portions of the Rails site in Scala.

Facebook however has decided to double down on PHP, releasing HipHop, a PHP source code transfomer:

HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP’s runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.

** Update **

We posted this blind yesterday when GitHub was unavailable. Looks like the repo isn’t public yet. Keep an eye out. GitHub explore shows five watchers…

[Source on GitHub] [Announcement]

PHP changelog.com/posts

phpMoAdmin: MongoDB admin tool for PHP

Extra (or deducted, depending on your point of view) points for an SEO optimized repo name, phpMoAdmin aims to be mo’ admin than phpMyAdmin by providing a MongoDB administration tool for PHP. phpMoAdmin is built on a stripped-down version of the Vork high-performance framework.

Features include:

  • Database
    • List
    • Create/drop
    • Repair
  • Collection
    • Show collections
    • Create/drop collection
    • List indexes
    • Create/drop indexes
  • Data objects
    • Show objects with 3-different viewing options (full, compact & uniform)
    • Create/delete objects
    • Edit object data
  • Mongo GridFS
    • GridFS objects automatically link GridFS chunks to GridFS files

[Source on GitHub] [Homepage]

Drupal changelog.com/posts

Drupal 7.0 Alpha 1 released

After nearly two years of development, we are proud to announce the release of the first alpha version of the Drupal 7.x family. This alpha includes a tremendous number of new features and new under-the-hood improvements for both users and developers.

What’s new, what’s changed?

  • Revamped User Interface
  • Custom Fields
  • Image Handling
  • Update Manager
  • Front-end “under-the-hood” improvements
  • Back-end “under-the-hood” improvements

[Mirror on GitHub] [Official Release] [Homepage]

PHP changelog.com/posts

WordPress 2.9 released

WordPress 2.9 ‘Carmen’ is out. Release highlights include:

  1. Global undo/”trash” feature, which means that if you accidentally delete a post or comment you can bring it back from the grave (i.e., the Trash). This also eliminates those annoying “are you sure” messages we used to have on every delete.

  2. Built-in image editor allows you to crop, edit, rotate, flip, and scale your images to show them who’s boss. This is the first wave of our many planned media-handling improvements.

  3. Batch plugin update and compatibility checking, which means you can update 10 plugins at once, versus having to do multiple clicks for each one, and we’re using the new compatibility data from the plugins directory to give you a better idea of whether your plugins are compatible with new releases of WordPress. This should take the fear and hassle out of upgrading.

  4. Easier video embeds that allow you to just paste a URL on its own line and have it magically turn it into the proper embed code, with Oembed support for YouTube, Daily Motion, Blip.tv, Flickr, Hulu, Viddler, Qik, Revision3, Scribd, Google Video, Photobucket, PollDaddy, and WordPress.tv (and more in the next release).

[Download] [Announcement]

0:00 / 0:00