Shop development
Language
Table of content
Wiki
Documentation
Software
Project
This page describes the development process and how to setup develop environment for e-commerce system. E-commerce code is maintained using git.
Read e-commerce server install and follow the instructions on how to install and configure all the software.
Setup
PHP builtin server is enough during development process, but to be able to simulate remote nginx and php environment before pushing work, the web server user must have permission to read and write to some folders. Clone code from git repository and checkout develop branch;
$ git clone git://git.leetio.dev/shop.git $ cd shop/upload $ git checkout -b develop
Start php built in php to test setup;
$ php -S localhost:9000
When using upstream code make sure to run dos2unix outside git repository.
$ cd tmp/ $ find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix
Bootstrap
Code bootstrap sequence is index.php -> system/startup.php -> system/framework.php.
- index.php
- Does little, only defines the version, checks if configuration file exists, if exists requires (loads) it. If configuration was not included or DIR_APPLICATION is defined it redirects to installer index.
- system/startup.php
- Checks some PHP requirements and PHP variable definitions before loading framework. Sets error handling function, time zone and requires (loads) framework files.
- system/framework.php
- Instantiate framework classes, it starts by creating global registry where the global classes are stored.
Registry should be avoided in favor of dependency injection (factory) where possible.
Database
E-commerce system supports different drivers but is migrating to a cleaner, faster and safer solution, new or fixed code will use pdo class to access databases.
MariaDB
Whentesting fresh install to delete previous database;
$ mysql -u root -p > SHOW DATABASES; > DROP SCHEMA db_shop;
And if necessary the user;
> DROP USER 'db_shop_user'