Spiral Framework uses Composer to resolve dependencies and install required components. You can check how to install composer here.
Make sure that your server is configured with following PHP version and extensions:
One of fastest ways to install a fresh spiral application is to use the composer command:
$ php composer.phar create-project spiral/application {dir}
Initial application installation will automatically configure framework and environment to ensure that all necessary directories have the correct permissions and are available for application, also it will perform translator indexation and view compilation (you can register you own commands in configure sequence, see Console Dispatcher).
You can also configure your application at any moment, by simply executing:
$ ./spiral configure
Make sure that spiral
has right execute permissions (chmod +x spiral
, also you can rename spiral
and spiral.cli
to any name you want).
You can run command(s) with increaced verbosity
-vv
to get more details.
Please make sure that runtime
directory located in a root of your project is writable for your web worker (usually www-data
group).
Default spiral application and framework core utilize dotenv package which provides you ability to keep your environment settings in .env
file, thought you can replace default implementation to avoid un-nesessary filesystem requests, follow this link for more instructions.
Enviroment file
.env
will be automatically created and pre-configured as moment of application installation.
Your application configuration files are located in app/config
directory, every configuration file are represented by a simple PHP script which has to return array as it's result:
<?php
/**
* EncrypterManager component configuration file. Attention, configs might include runtime code
* which depended on environment values only.
*
* @see EncrypterConfig
*/
return [
/*
* Encryption key can be found in .env file. You can generate new encryption key via console
* command "app:key".
*/
'key' => env('SPIRAL_KEY'),
];
If you wish to make your configuration depend on environment settings, use function env(key, default)
.
Attention, your configuration files will be cached relatively to current enviroment, you should not include any code which does not depend of
env
values!
Check ConfiguratorInterface
and ConfigFactory
in order to implement additional config loading methods (i.e. yaml).