Development Basics

Redaxscript is feature complete! Our goal is to refactor the deprecated codebase to an object oriented and modern approach.

Continuous integration

A bunch of frontend and backend tools run on Travis CI and Appveyor once a commit has been pushed.

Continuous inspection

Scrutenizer and Coveralls are our weapons of choice to keep track on the quality of our codebase.

Continuous deployment

We deploy our Demo on a daily basis from the master branch.

Edit on GitHub

Coding Standards

General

We prefer the Allman style and tabs to indent code:

if ($hello === 'world')
{
	$output = 'hello';
}
else
{
	$output = 'world';
}

Styles

We prefer NCSS to give our PostCSS a semantic meaning:

.rs-text-hello
{
	&.rs-is-active
	{
		display: block;
	}
}
Edit on GitHub

Local Environment

Consider to use the docker container before spending hours to get your local environment running.

Install Git

Install Git on your local environment:

apt-get install git

Config Git

Config your name and email:

git config --global user.name {Your Name}
git config --global user.email {your.name@domain.com}

Install Node

Install Node on your local environment:

apt-get install nodejs

Install Grunt

Install Grunt on your local environment:

npm install --global grunt-cli

Install PHP

Install PHP on your local environment:

apt-get install php php-cli php-dev

Install Composer

Install Composer on your local environment:

apt-get install composer

Install SQLite

Install the SQLite bundle on your local environment:

apt-get install sqlite3 php-sqlite3

Install MSSQL

Install the MSSQL bundle on your local environment:

apt-get install msodbcsql mssql-server unixodbc-dev
pecl install pdo_sqlsrv

Config MSSQL

Add the extension to your php.ini file:

extension=pdo_sqlsrv.so

Create a test database:

sqlcmd -U sa -P {your-password}
CREATE DATABASE test
GO

Install MySQL

Install the MySQL bundle on your local environment:

apt-get install mysql-server mysql-client php-mysql

Config MySQL

Create a test database:

mysql -u root -e 'create database test'

Set the root password:

mysqladmin -u root password test

Install PostgreSQL

Install the PostgreSQL bundle on your local environment:

apt-get install postgresql php-pgsql

Config PostgreSQL

Create a test database:

psql -U postgres -c 'create database test' 

Set the root password:

psql -U postgres -c 'alter user postgres with password '\'test\'

Install Xdebug

Install Xdebug on your local environment:

apt-get install php-xdebug

Install Sendmail

Install Sendmail on your local environment:

apt-get install sendmail

Tweak /etc/hosts if messages stuck in the Sendmail queue:

127.0.0.1 {your-hostname}.localdomain {your-hostname} localhost
Edit on GitHub

Frontend Tools

Install

Install the tools described in this section:

npm install

Lint

Validate your PostCSS code for consistence:

grunt stylelint
grunt colorguard

Validate your JavaScript code for consistence:

grunt jscs
grunt jshint

Validate your HTML code for consistence:

grunt htmlhint

Build

Build styles, scripts and fonts at once:

grunt build

Build the styles:

grunt build-styles

Build the scripts:

grunt build-scripts

Build the fonts:

grunt build-fonts

Optimize

Create table of contents for your assets and optimize images:

grunt optimize
Edit on GitHub

Backend Tools

Install

Install the tools described in this section:

npm install
composer install

Lint

Validate your PHP code for consistence:

grunt phpcs
grunt phpcpd
grunt phpstan

Test

Run the PHP testing suite:

grunt phpunit

Run the PHP testing suite in parallel:

grunt phpunit-parallel

Run the PHP testing suite against your MSSQL database:

npm run phpunit-mssql

Run the PHP testing suite against your MySQL database:

npm run phpunit-mysql

Run the PHP testing suite against your PostgreSQL database:

npm run phpunit-pgsql

Create a coverage report:

grunt phpunit --coverage-html {directory}

Benchmark

Run the PHP benchmarking suite:

grunt phpbench
Edit on GitHub

Docker Container

Get the dockernized version of Redaxscript on Docker Hub.

Terminal

Pull from the Docker hub:

docker pull redaxmedia/redaxscript

Build or rebuild services:

docker-compose build

Create and start containers:

docker-compose up

Run interactive shell in container:

docker exec -it redaxscript /bin/bash

Browser

Browse your working copy:

http://localhost:8080
Edit on GitHub