{{body}}
22 |├── .gitignore ├── lib └── .gitignore ├── public ├── css │ ├── style.css │ └── .gitignore ├── js │ ├── script.js │ └── .gitignore ├── .gitignore ├── img │ └── .gitignore ├── .htaccess └── index.php ├── tests └── .gitignore ├── include ├── .gitignore └── services.php ├── routes ├── .gitignore └── app.php ├── templates ├── .gitignore └── index.html ├── db └── .gitignore ├── config ├── .gitignore └── config.php.example ├── logs └── .gitignore ├── composer.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/* 2 | -------------------------------------------------------------------------------- /lib/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /public/css/style.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/js/script.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /include/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /public/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /public/css/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /public/img/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /public/js/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /routes/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /templates/.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /db/.gitignore: -------------------------------------------------------------------------------- 1 | # prevent accidental commit 2 | sqlite.db 3 | -------------------------------------------------------------------------------- /config/.gitignore: -------------------------------------------------------------------------------- 1 | # prevent accidental commit 2 | config.php 3 | -------------------------------------------------------------------------------- /logs/.gitignore: -------------------------------------------------------------------------------- 1 | # prevent accidental commit 2 | * 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine on 2 | RewriteCond %{REQUEST_FILENAME} !-f 3 | RewriteCond %{REQUEST_FILENAME} !-d 4 | RewriteRule ^(.*)$ /index.php 5 | 6 | Options -Indexes 7 | -------------------------------------------------------------------------------- /routes/app.php: -------------------------------------------------------------------------------- 1 | get( 3 | '/', 4 | function () use ($app, $c) { 5 | $app->view()->setData(array( 6 | 'title' => 'Hello World', 7 | 'body' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' 8 | )); 9 | $app->render('index.html'); 10 | } 11 | ); 12 | 13 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": ">=5.3", 4 | "pimple/pimple": "dev-master", 5 | "slim/slim": "dev-master", 6 | "slim/views": "dev-master", 7 | "twig/twig": "dev-master", 8 | "vrana/notorm": "dev-master" 9 | }, 10 | 11 | "require-dev": { 12 | "phpunit/phpunit": "3.*" 13 | }, 14 | 15 | "autoload": { 16 | "classmap": [ 17 | "include/", 18 | "lib/" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SlimBootstrap 2 | 3 | Bootstrap for a basic PHP application using Slim, Pimple, Twig, and NotORM 4 | 5 | - Copy `config/config.php.example` to `config/config.php` and supply values 6 | - Routing defined in `routes` directory - files inherit `$app` (Slim instance) and `$c` 7 | (Pimple container) when included into `public/index.php` 8 | - Resources/services in Pimple DI container defined in `include/services.php` 9 | - `composer.json` instructs Composer to build classmap from `include/` and `lib/` 10 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | run(); 23 | -------------------------------------------------------------------------------- /config/config.php.example: -------------------------------------------------------------------------------- 1 | E_ALL, 7 | 'php.display_errors' => true, 8 | 'php.log_errors' => true, 9 | 'php.error_log' => $basedir . 'logs/errors.txt', 10 | 'php.date.timezone' => 'America/New_York', 11 | 12 | // SQLite 13 | 'db.dsn' => 'sqlite:' . $basedir . 'db/sqlite.db', 14 | 15 | // MySQL 16 | /* 17 | 'db.dsn' => 'mysql:host=localhost;dbname=test', 18 | 'db.username' => 'dbuser', 19 | 'db.password' => 'dbpass', 20 | */ 21 | 22 | // Application paths 23 | 'path.routes' => $basedir . 'routes/', 24 | 'path.templates' => $basedir . 'templates/' 25 | ); 26 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |{{body}}
22 |