Skip to content

Instantly share code, notes, and snippets.

@briward
Last active February 11, 2016 13:56
Show Gist options
  • Save briward/073fd317bfe91f7eff60 to your computer and use it in GitHub Desktop.
Save briward/073fd317bfe91f7eff60 to your computer and use it in GitHub Desktop.
<?php
require __DIR__ . '/vendor/autoload.php';
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;
$container = new \Slim\Container;
// Register the Flysystem service.
$container['flysystem'] = function ($container) {
$adapter = new Local(__DIR__);
return new Filesystem($adapter);
};
// Instantiate the App and pass in our container.
$app = new Slim\App($container);
// Routes
$app->get('/', function($request, $response, $args) {
// Retrieve the service from the container and read our file.
return $this->get('flysystem')->read('myFile.txt');
});
$app->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment