Skip to content

Instantly share code, notes, and snippets.

set_exception_handler($app->wrap(function (\Exception $exception, \Whoops\Run $run) {
$run->handleException($exception);
}));
/tests export-ignore
/stubs export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/phpunit.xml export-ignore
/changelog.md export-ignore
/readme.md export-ignore
@hannesvdvreken
hannesvdvreken / ignore-platform-requirements.md
Last active March 18, 2023 04:19
ignore platform requirements

Composer update without PHP environment checking

Hi there, welcome for another blog post on Composer.

Since version 1.0.0-alpha9 composer has a new flag for the install and update commands. I'm talking about the --ignore-platform-reqs flag. From the changelog:

Added --ignore-platform-reqs to install/update commands to install even if you are missing a php extension or have an invalid php version.
@hannesvdvreken
hannesvdvreken / travis.yml
Last active August 29, 2015 14:13
travis.yml
- before_script:
- travis_retry composer self-update
- travis_retry composer install --ignore-platform-reqs --no-interaction --prefer-source
@hannesvdvreken
hannesvdvreken / name-route-segments.php
Created January 29, 2015 13:24
Named route segments
<?php
use League\Container\Container;
use League\Route\RouteCollection;
use League\Route\Strategy\MethodArgumentStrategy;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
require 'vendor/autoload.php';
@hannesvdvreken
hannesvdvreken / htaccess
Last active August 29, 2015 14:15
htaccess
RewriteCond %{REQUEST_URI} =~ "/public.(pictures.(products|banners)|images.default\-).*/"
RewriteRule ^ - [E=cache_control:1,L]
Header unset Last-Modified env=cache_control
Header unset ETag env=cache_control
FileETag None env=cache_control
Header set cache-control "public, max-age=26426400" env=cache_control
ExpiresDefault "access plus 10 months" env=cache_control
function helper(arg1, callback) {
// do something…
callback(data);
}
obj = {
name: 'John Doe',
bar: function() {
helper('foo', function(data) {
console.log(this);
function helper(arg1, callback, context) {
// do something…
callback.call(context, data);
}
obj = {
name: 'John Doe',
bar: function() {
helper('foo', function(data) {
console.log(this);
@hannesvdvreken
hannesvdvreken / index.php
Created March 3, 2015 19:00
league/route with methodargumentstrategy and registered callables
<?php
use League\Container\Container;
use League\Route\RouteCollection;
use League\Route\Strategy\MethodArgumentStrategy;
use Symfony\Component\HttpFoundation\Request;
require 'vendor/autoload.php';
$container = new Container();
@hannesvdvreken
hannesvdvreken / index.php
Last active August 29, 2015 14:16
proton script to test booboo integration
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
require 'vendor/autoload.php';
$app = new Proton\Application();
$app->get('/user/{username}', function (Request $request, Response $response, $args) {