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.
<?php | |
/* Shorten a URL using Google's goo.gl API. Requires an API key. */ | |
function googl_shorten_url($url, $api_key) { | |
$endpoint = 'https://www.googleapis.com/urlshortener/v1'; | |
$ch = curl_init(sprintf('%s/url?key=%s', $endpoint, $api_key)); | |
curl_setopt_array($ch, array( | |
\CURLOPT_POST => true | |
, \CURLOPT_AUTOREFERER => true | |
, \CURLOPT_FOLLOWLOCATION => true | |
, \CURLOPT_SSL_VERIFYPEER => false |
<?php | |
function github_markdown($text) { | |
$ch = curl_init('https://api.github.com/markdown/raw'); | |
curl_setopt_array($ch, array( | |
\CURLOPT_POST => true | |
, \CURLOPT_RETURNTRANSFER => true | |
, \CURLOPT_POSTFIELDS => $text | |
, \CURLOPT_SSL_VERIFYPEER => false | |
, CURLOPT_HTTPHEADER => array('Content-Type: text/plain'))); |
<?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. |
A list of amazingly awesome PHP libraries, resources and shiny things.
<?php | |
/* From: http://www.php.net/manual/en/function.str-getcsv.php#88773 and http://www.php.net/manual/en/function.str-getcsv.php#91170 */ | |
if(!function_exists('str_putcsv')) | |
{ | |
function str_putcsv($input, $delimiter = ',', $enclosure = '"') | |
{ | |
// Open a memory "file" for read/write... | |
$fp = fopen('php://temp', 'r+'); | |
// ... write the $input array to the "file" using fputcsv()... | |
fputcsv($fp, $input, $delimiter, $enclosure); |
#!/bin/bash | |
# | |
# Steam installer for Debian wheezy (32- and 64-bit) | |
# | |
# Place into empty directory and run. | |
# | |
download() { | |
local url="$1" | |
local filename="$(basename "$url")" |
function cd { | |
if (("$#" > 0)); then | |
if [ "$1" == "-" ]; then | |
builtin popd >/dev/null | |
elif [ "$1" == "--" ]; then | |
dirs -v | |
return $? | |
elif [ "$1" == "." ]; then | |
# break out of symlinked dir (cd into realpath) | |
builtin pushd "`pwd -P`" >/dev/null |
This is a PHP (5.3+) microframework based on anonymous functions.
$priority
This is a local copy of the commands from: