-
Notifications
You must be signed in to change notification settings - Fork 1
Apps
Apps are designed to be complete containers. In other words, they are being designed to be drag and dropped into a project and work in any project with no internal configurations, and very little external configuration.
To create an app, create a folder with the app name into the application/app/ directory
Inside that directory, create a templates directory as well as a config.php file.
The config file is meant to create app specific header and footer templates
// application/app/appname/config.php file
return [
"header" => "appname.base",
"footer" => "appname/footer"
];Apps can be installed from GitHub. Find the app you want on GitHub and then in the command line do:
In the root directory, (the directory that contains the cli.php file)
$ php cli.php --install githubaccount/reponameTo try this out for a real app, do:
$ php cli.php --install taloncode/mustachethis will install an pre made app into your app directory
Each app can have its own router added to the main application/Routes/routes.php file.
Open up your main config/config.php file and add a templates array to the file like so:
return [
'database' => [
'username' => 'user',
'password' => 'password',
],
'templates' => [
'dollarscore',
'mustache',
],
'header' => 'dollarscore.base',
'footer' => 'dollarscore.footer',
];This will add the apps routers in order they are in the templates array
Apps can have dependencies on other apps. This will install other apps at the same time your's is downloaded. If you are building a multi-app package, you can add app dependencies to your main app like so:
return [
'database' => [
'username' => 'user',
'password' => 'password',
],
'templates' => [
'dollarscore',
'mustache',
],
'dependencies' => [
'apps' => [
'taloncode/mustache'
]
],
'header' => 'dollarscore.base',
'footer' => 'dollarscore.footer',
];Middleware is also an option and can be added to your apps inside a middleware/middleware.php file inside the app. Middleware is run in the order it is listed in the main config.php file and is run on every page request.
return [
'database' => [
'username' => 'user',
'password' => 'password',
],
'templates' => [
'dollarscore',
'mustache',
],
'dependencies' => [
'apps' => [
'taloncode/mustache'
]
],
'middleware' => [
'app',
'anotherapp',
],
'header' => 'dollarscore.base',
'footer' => 'dollarscore.footer',
];