Skip to content

Instantly share code, notes, and snippets.

@rossriley
Created May 16, 2015 10:38
Show Gist options
  • Save rossriley/bdb56a8be82a52af2980 to your computer and use it in GitHub Desktop.
Save rossriley/bdb56a8be82a52af2980 to your computer and use it in GitHub Desktop.
# 1. composer.json
{
"name": "ross/myproject",
"description": "My Project",
"license": "proprietary",
"require": {
"bolt/bolt": "~2.1",
.... other requirements
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-update-cmd": [
"Bolt\\Composer\\ScriptHandler::installAssets",
"gulp"
]
},
"autoload": {
"psr-4": {
"Myproject\\": "src",
"Myproject\\Tests\\": "tests"
}
},
"extra": {
"bolt-web-dir": "./public",
"bolt-app-dir": "./app"
}
}
# 2. The Bootstrap (based on public/index.php)
<?php
$config = new Composer(__DIR__."/../");
$config->setPath('web', 'public');
$config->setPath('files', 'public/files');
$config->setPath("themebase","public/theme");
$config->getVerifier()->disableApacheChecks();
$config->verify();
$app = new Application(array('resources'=>$config));
$app->initialize();
$app->register(new Myproject\Provider\ServiceProvider($app));
if($app['config']->getWhichEnd()=='backend') {
$app['twig.loader.filesystem']->prependPath(__DIR__."/../src/templates/backend");
} else {
$app['twig.loader.filesystem']->prependPath(__DIR__."/../src/templates/frontend");
}
$app->run();
# 3. Routing to your custom controllers in routing.yml...
path: /
defaults: { _controller: 'controller.frontend:homepage' }
search:
path: /search
defaults: { _controller: 'controller.frontend:search' }
preview:
path: /preview/{contenttypeslug}
defaults: { _controller: 'controller.frontend:preview' }
requirements:
contenttypeslug: 'Bolt\Controllers\Routing::getAnyContentTypeRequirement'
contentlink:
path: /{contenttypeslug}/{slug}
defaults: { _controller: 'controller.frontend:record' }
requirements:
contenttypeslug: 'Bolt\Controllers\Routing::getAnyContentTypeRequirement'
...etc
@Boorj
Copy link

Boorj commented Jul 7, 2015

Thanks!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment