vhchung / slim3-skeleton-mvc
Simple Slim Framework 3 skeleton with Twig, Monolog, Doctrine.
Installs: 764
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 4
Forks: 3
Open Issues: 1
Type:project
Requires
- doctrine/orm: 2.5.*
- monolog/monolog: ^1.17
- slim/flash: ^0.1.0
- slim/slim: ~3.0
- slim/twig-view: ^2.0
This package is not auto-updated.
Last update: 2024-11-07 00:38:00 UTC
README
This is a simple skeleton project for Slim 3 that includes Doctrine, Twig, Flash messages and Monolog.
Base on https://github.com/akrabat/slim3-skeleton
Prepare
-
Create your project:
`$ composer create-project -n -s dev vhchung/slim3-skeleton-mvc your-app`
-
Execute
your-app\sql\blog.sql
to create sample database (MySQL) -
Change database connection settings at
entities_generator.php
andapp/settings.php
-
Generate models (Doctrine entities):
$ cd your-app
$ php entities_generator.php
Add namespace for each model: namespace App\Model;
Notice: Delete all models before re-generate to update models.
Run it:
$ cd your-app
$ php -S 0.0.0.0:8888 -t public/
- Browse to http://localhost:8888
Notice
Set logs
and cache
folder permission to writable when deploy to production environment
Key directories
app
: Application codeapp/src
: All class files within theApp
namespaceapp/templates
: Twig template filescache/twig
: Twig's Autocreated cache fileslog
: Log filespublic
: Webserver rootvendor
: Composer dependenciessql
: sql dump file for sample database
Key files
public/index.php
: Entry point to applicationapp/settings.php
: Configurationapp/dependencies.php
: Services for Pimpleapp/middleware.php
: Application middlewareapp/routes.php
: All application routes are hereapp/src/controllers/HomeController.php
: Controller class for the home pageapp/src/models/Post.php
: Entity class for post tableapp/templates/home.twig
: Twig template file for the home page