A list of amazingly awesome PHP libraries, resources and shiny things.
- Composer/Packagist - A package and dependency manager.
- Composer Installers - A multi framework Composer library installer.
| // Example 1 | |
| mediator.name = 'Doug'; | |
| mediator.subscribe('nameChange', function(arg){ | |
| console.log(this.name); | |
| this.name = arg; | |
| console.log(this.name); | |
| }); | |
| mediator.publish('nameChange', 'Jorn'); |
| <?php | |
| /** | |
| * Use this class to automatically generate files for Codeigniter. | |
| * This is to be used specifically with the file setup such as used | |
| * in the course Building a CMS with Codeigniter on tutsplus.com. | |
| * | |
| * Just place this in your appllication/controllers folder and run it. | |
| * NOTE: the ENVIRONMENT constant has to be set to 'development' or the | |
| * class will return a 404. | |
| * |
| <?php | |
| /** | |
| * Dump helper. Functions to dump variables to the screen, in a nicley formatted manner. | |
| * @author Joost van Veen | |
| * @version 1.0 | |
| */ | |
| if (!function_exists('dump')) { | |
| function dump ($var, $label = 'Dump', $echo = TRUE) | |
| { | |
| // Store dump in variable |
| <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
| class MY_Model extends CI_Model { | |
| /** | |
| * The database table to use. | |
| * @var string | |
| */ | |
| public $table_name = ''; | |
| <?php | |
| /** | |
| * Filter input based on a whitelist. This filter strips out all characters that | |
| * are NOT: | |
| * - letters | |
| * - numbers | |
| * - Textile Markup special characters. | |
| * | |
| * Textile markup special characters are: |
| <?php | |
| /** | |
| * SplClassLoader implementation that implements the technical interoperability | |
| * standards for PHP 5.3 namespaces and class names. | |
| * | |
| * http://groups.google.com/group/php-standards/web/final-proposal | |
| * | |
| * // Example which loads classes for the Doctrine Common package in the | |
| * // Doctrine\Common namespace. |
| image.gallery <- function(url, ncol = 3L) { | |
| ## This function reformats the contents of a Craigslist search result URL | |
| ## into an image gallery, opened into the default browser | |
| ## | |
| ## Inputs: | |
| ## - url: a Craigslist search URL as created by search.url | |
| ## - ncol: the number of columns for the output image gallery | |
| ## | |
| ## Output: none. As a side effect, a browser is opened. |
| // jQuery Plugin for post loading images | |
| $.fn.postLoadImages = function(callback) { | |
| var imgLen = this.length, | |
| count = 0; | |
| return this.each(function(count) { | |
| count++; | |
| if ($(this).attr('data-src')) { | |
| var imgTag = this, imgSrc = $(this).attr('data-src'); | |
| i = new Image(); |
| <?php | |
| /* | |
| Plugin Name: Rewrite Rule Tutorials | |
| */ | |
| add_action( 'init', 'pmg_rewrite_add_rewrites' ); | |
| function pmg_rewrite_add_rewrites() | |
| { | |
| add_rewrite_endpoint( 'json', EP_PERMALINK ); | |
| add_rewrite_rule( |
A list of amazingly awesome PHP libraries, resources and shiny things.