ansas / slim-skeleton
Slim 3 framework skeleton - skeleton for a web service or an application
Installs: 38
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 5
Forks: 0
Open Issues: 0
Type:application
Requires
- php: >=5.4
- ansas/php-component: dev-master
- monolog/monolog: dev-master
- slim/slim: ~3
- slim/twig-view: dev-master
- twig/extensions: dev-master
- twig/twig: ~1
Suggests
- phpdocumentor/phpdocumentor: Documentation - should be installed globally
- phpunit/phpunit: Testing - should be installed globally
- propel/propel: ORM
- slim/http-cache: Caching: client-side
- squizlabs/php_codesniffer: Coding standard - should be installed globally
- tedivm/stash: Caching: server-side PSR-6
README
Skeleton for a web service or an application (based on Slim 3 framework).
This skeleton follows several PHP Standards Recommendations (PSR):
- PSR-1 / PSR-2 (Coding standards)
- PSR-3 (Logging) via Monolog
- PSR-4 (Autoloading) via Composer
- PSR-7 (HTTP message) via Slim
Included components
- Slim 3.x incl. Flash messages & Twig view (MIT License)
- Twig template engine 1.x (BSD License)
- Monolog logger 1.x (MIT License)
- Custom Error and NotFound handler
- Middlewares: Cors, ForceRoute, Runtime, NoTrailingSlash, etc.
- Provider: ConsoleLoggerProvider, ExtendedRequestProvider, PdoProvider, ProfilerProvider, etc.
- Tests: PHPUnit bootstrap and AppTestCase prepared
Directory structure
path/to/project
|-- app <- Application config files
| |-- slim <- Slim config files
| `-- twig <- Twig templates
|-- bin <- Own scripts
|-- etc <- Own config files (like Apache)
|-- lib <- Vendor files (for composer)
|-- log <- Log files
|-- pub <- Webserver document root
| |-- css
| |-- img
| |-- js
| `-- lib
|-- src <- Application classes
| `-- App
| |-- Controller
| |-- Handler <- Put custom handlers here
| |-- Middleware <- Put custom middlewares here
| |-- Model
| |-- Provider <- Put custom providers here
| `-- Tests <- Put custom tests (unit and integration tests) here
`-- tmp <- Temporary files
| |-- session
| `-- twig
`-- var <- Put other data in here
Requirements
- PHP 7
- Composer (MIT License)
Usage
Install / Create project
$ composer create-project ansas/slim-skeleton path/to/project
Develop / Run PHP build-in server
$ cd path/to/project
$ composer server
Open web browser with address http://any-domain-pointing-to-server:8888
Call controller from console
$ cd path/to/project $ composer run The\Controller\YouWantToRun <- calls __invoke() $ composer run The\Controller\YouWantToRun:methodWanted $ composer run The\Controller\YouWantToRun:methodWanted parem1=yes param2=hi
Test / Check coding style and test code
$ cd path/to/project $ composer test
Contribute
Everybody can contribute to this package. Just:
- fork it,
- make your changes and
- send a pull request.
Please make sure to follow PSR-1 and PSR-2 coding conventions.
License
MIT license (see the LICENSE file for more information).