public function getFile(Application $app, $vendor, $file) { /** @var Finder $finder */ $finder = $app['finder']; $finder->path($vendor)->name($file); /** @var SplFileInfo $file */ foreach ($finder as $file) { return $app->sendFile($file->getRealPath()); } return null; }
<?php use Rarst\ReleaseBelt\Application; require __DIR__ . '/vendor/autoload.php'; $app = new Application([]); $app->run();
<?php use Rarst\ReleaseBelt\Application; use Silex\Provider\SecurityServiceProvider; require __DIR__ . '/vendor/autoload.php'; $configPath = __DIR__ . '/config.php'; $app = new Application(file_exists($configPath) ? require $configPath : []); if (empty($app['security.default_encoder'])) { $app->register(new SecurityServiceProvider()); } if (!empty($argv[1])) { $encoder = $app['security.default_encoder']; echo $encoder->encodePassword($argv[1], ''); }