This is an old revision of the document!
Rack — A framework, typically with rails, bars, hooks, or pegs, for holding or storing things.
Rack is a small and simple boilerplate/framework for PHP based web applications that are integrated with the login API of the Cover website. It aims to ease the creation of websites or microservices that only need a small number of forms, tables and views and to provide a familiar project structure among most of Cover's PHP projects. Additionally, anybody with basic OOP skills and a basic understanding of the web should be able to easily comprehend the framework and setup a website.
Rack implements the following features:
Clone (or fork or download) the Bitbucket repository into the root folder of your project and you're ready to go!
Projects using Rack adhere to the following structure:
📁 Project ├ 📁 include │ ├ 📁 models │ │ ├ 📁 migrations │ │ ├ Model.class.php │ │ └ … (model definitions) │ ├ config.php │ ├ include.php │ └ … (other Rack logic php files) ├ 📁 static │ ├ 📁 css │ ├ 📁 js │ ├ 📁 img │ └ … (other static content) ├ 📁 templates │ ├ error.phtml │ ├ index.phtml │ ├ layout.phtml │ └ … (templates for other views) ├ index.php └ … (other views)
The include
folder is meant Rack's internal logic and possible application-specific extensions to it. It should not contain any views, templates or static files.
To work, a config file include/config.php
is needed. A default configuration is provided in include/config.php.default
and can be copied to initialize the config.php
file. Remember that this config file is likely to contain passwords, so it should be added to the .gitignore
file to prevent it from showing up in Git repositories. Do not forget to change it's file permissions to hide it from other users on the system. This can be done with the following command: chmod 700 include/config.php
.
This table lists all configuration options implemented by Rack. If you implement any configuration options or use an external library that does, you use the config.php
file for this as well.
Name | Required | Default | Description |
---|---|---|---|
ADMIN_COMMITTEE | <php>'webcie'</php> | The login of the committee that should have admin access. It's the identifier used in the url of your committee page on the Cover website. | |
ADMIN_EMAIL | The email address of the admin committee. | ||
COVER_APP | Y | The name of the application, used for authentication. | |
COVER_API_URL | <php>'https://www.svcover.nl/api.php'</php> | The url of the Cover API. Usually, this doesn't need to be set. | |
COVER_COOKIE_NAME | <php>'cover_session_id'</php> | Name of the cookie used to identify the Cover session. Usually, this doesn't need to be set. | |
COVER_LOGIN_URL | <php>'https://www.svcover.nl/sessions.php?view=login'</php> | The Cover website login url. Usually, this doesn't need to be set. | |
COVER_LOGOUT_URL | <php>'https://www.svcover.nl/sessions.php?view=logout'</php> | The Cover website logout url. Usually, this doesn't need to be set. | |
COVER_SECRET | Y | A shared secret between your app and the Cover website. You can obtain one through the AC/DCee | |
ERROR_TEMPLATE | <php>'templates/error.phtml'</php> | Te name of the template used to render errors. | |
DB_DSN | Only for DB | The connection string for your database. Looks like <php>'mysql:host=localhost;dbname=committeedbname'</php> | |
DB_USER | Only for DB | Your database username. | |
DB_PASSWORD | Only for DB | Your database password. | |
SERVER_NAME | Y | The url of the application, used for authentication. |
The following pages contain short documentation of the available classes and functions. They are meant to provide an overview of the features and dataflows. Anybody in need of implementation specific detail is advised to inspect the source code.