Lasys
is a simple PHP framework.
Put lasys
in your project:
cd "dir_of_your_project"
git clone "[email protected]:lasyard/lasys.git"
or as a submodule if your project is also managed by git:
git submodule add "[email protected]:lasyard/lasys.git"
Build the public resources:
npm install
npm run release-build
Create a directory to put the public resources:
mkdir "pub"
then make a symlink from lasys/pub
to pub/sys
:
ln -snf "lasys/pub" "pub/sys"
Create app entry entry.php
. The contents of the file is like:
<?php
define('ROOT_PATH', __DIR__);
require_once 'lasys/src/sys.php';
Sys::app()->run();
It is crucial to put the file at the root of project, so that ROOT_PATH
can be defined properly.
Rewrite all to entry.php
except /pub
. for example, in .htaccess
:
DirectoryIndex disabled
Options -Indexes -Multiviews
RewriteEngine On
RewriteRule !^pub index.php [L,NS]
Constants can be defined in entry.php
. If one is not defined, it will be set to a default value.
date_default_timezone_set('Asia/Shanghai');
define('APP_TITLE', 'Lasys'); // The title of app.
define('CONFIG_DIR', 'configs'); // The dir of config files.
define('DATA_DIR', 'data'); // The root dir of website contents.
define('PUB_DIR', 'pub'); // The dir of public assets.
define('VIEW_DIR', 'views'); // The dir of view files.
define('ACTIONS_DIR', 'actions'); // The dir of actions.
define('SITE', 'unknown'); // For multi-site deployment.
The values defined above are default values.
There must be a directory named configs
in the root of your project to put your config files. Config files are .php
files.