mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 06:06:45 +02:00
feat(console): update flextype bin script #543
This commit is contained in:
56
bin/flextype
56
bin/flextype
@@ -1,12 +1,58 @@
|
||||
#!/usr/bin/env php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
namespace Flextype;
|
||||
|
||||
$application = new Application();
|
||||
/**
|
||||
* Define the application minimum supported PHP version.
|
||||
*/
|
||||
define('FLEXTYPE_MINIMUM_PHP', '7.4.0');
|
||||
|
||||
// ... register commands
|
||||
/**
|
||||
* Define the PATH to the root directory (without trailing slash).
|
||||
*/
|
||||
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
|
||||
|
||||
$application->run();
|
||||
/**
|
||||
* Define the PATH (without trailing slash).
|
||||
*/
|
||||
define('PATH', [
|
||||
'project' => ROOT_DIR . '/project',
|
||||
'tmp' => ROOT_DIR . '/var/tmp',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Check PHP Version
|
||||
*/
|
||||
version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least <strong>PHP %s</strong> to run.', $ver, $req));
|
||||
|
||||
/**
|
||||
* Ensure vendor libraries exist
|
||||
*/
|
||||
! is_file($flextypeAutoload = ROOT_DIR . '/vendor/autoload.php') and exit('Please run: <i>composer install</i> for flextype');
|
||||
|
||||
/**
|
||||
* Register The Auto Loader
|
||||
*
|
||||
* Composer provides a convenient, automatically generated class loader for
|
||||
* our application. We just need to utilize it! We'll simply require it
|
||||
* into the script here so that we don't have to worry about manual
|
||||
* loading any of our classes later on. It feels nice to relax.
|
||||
* Register The Auto Loader
|
||||
*/
|
||||
$flextypeLoader = require_once $flextypeAutoload;
|
||||
|
||||
/**
|
||||
* Bootstraps the Flextype
|
||||
*
|
||||
* This bootstraps the Flextype and gets it ready for use, then it
|
||||
* will load up this application so that we can run it and send
|
||||
* the responses back to the browser and delight our users.
|
||||
*/
|
||||
|
||||
require_once ROOT_DIR . '/src/flextype/flextype.php';
|
Reference in New Issue
Block a user