Slim + Twig + Idiorm + SAML2 Skeleton app with login, applog and localization
Create a basic Slim Micro PHP Framework with Twig, Idiorm and SAML2 to bootstrap a web application with the following components:
- Site stylesheet definition uses less and grunt tasks to generate css.
- Data models for User and Application Logs
- Localization and Translations prepared for Twig
- Singleton File Logger using Monolog
/
- app (application libs and core files)
- conf (application configurations)
- apache (apache config files)
- html (holds html assets)
- assets (use this folder to store images, icons and fonts)
- css (location of the css stylesheet originated from compiling less. do not place css stylesheets here, use the less folder for that)
- js (use this folder to store application specific javascripts)
- less (template for the page stylesheet)
- locale (translations)
- models (php classes for database models)
- templates (twig templates for the webpages)
- utilities (programs and utilities)
- Install this code tree on a directory at your choice
- Validate that all the needed PHP extensions are installed
- Configure the project to your own settings
- Change application name in app config files package.json and composer.json
- Add project specific dependencies to package.json and composer.json
- Create and customize configuration file in app/config.php using app/config-dist.php as reference
- Customize html/.htaccess file 1. Define application environment in SetEnv SLIM_MODE
- Create an apache configuration file (.conf) using conf/apache/webapp.conf.sample as reference 1. Define port, server name and home variables in this file
- Install composer
- Go to composer download page and folow the instructions to download composer.
- On the project root run ./composer.phar install to install composer dependencies.
- Install npm
- On CentOS run yum instal npm to install npm
- Run npm install -g grunt-cli to install grunt client
- Run npm install to install grunt and required project dependencies
- Run grunt init tasks
- run grunt bootstrap for preparing app css styles
- run grunt& for listening for changes in less folder and updating application stylesheet
- Configure apache using the configuration file in conf/apache/webapp.conf
- Create and configure database for application. Define dabase access in app/config.php.
- Create tables for models defined in models folder. Script in utils/db/gen_mysql.php shows how this can be done with the sample models for User and AppLog. The code in utils/db/gen_mysql.php is directed for MySQL databases.
- start coding your app
- Use the templates folder for developing the webpages. Use twig as templating engine.
- Use the less folder for developing the site style.
- In html/assets/ico folder there is a set of favicons that can be changed with the site brand. Use favicon generator to generate the required files from a single image.
- If you need debug info, set the environment variable "deploy_mode" to "development".
- Install project dependencies
- Run ./composer.phar update to install composer dependencies
- Run npm install to install npm dependencies
- Run grunt dist to prepare final stylesheet for
- Configure SimpleSAML authentication
The project uses the Codeception test framework to verify the integrity of the application. Codeception is included as a development component.
To initialize the testing component in your project run the following command on the root of the project folder: codecept bootstrap. This will create the codeception.yml file and populate the tests folder with the basic configuration.
Acceptance tests may require the phantomjs webdriver to interact with javascript pages. You need to install phantomjs in your development server to be able to run the acceptance tests. Please check the phantomjs website for information on how to install.
After installing phantomjs please check the port where phantomjs is running and set it accordingly in the ./tests/acceptance.suite.yml file. You can start the phantomjs server with the default configuration (port 4444) using the script in ./bin/start_phantomjs.sh.
To run all tests execute ./vendor/bin/codecept run in the project folder. To run just the acceptance tests execute ./vendor/bin/codecept run acceptance in the project folder.