Last active
February 11, 2016 13:56
-
-
Save briward/073fd317bfe91f7eff60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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