Wallogit.com
2017 © Pedro Peláez
git clone https://github.com/follower90/framework-admin.git cms cd cms
Write your database connect options, (*1)
composer install
./builder schema:update 'admin' ./builder schema:update 'app'
./builder schema:migrate 'admin' ./builder schema:migrate 'app'
Setup host as usual website on your local Apache/Nginx Or just run this command in cms folder using built-in PHP web server., (*2)
php -S localhost:4000
docker-compose up
./start_nginx 4000 ./stop_nginx 4000
Try http://localhost:4000/ to access web-site Try http://localhost:4000/admin to login admin part, (*3)
Default login/password: admin/1234, (*4)
Default routing for pages will work as:, (*5)
yoursite.com/controller/action?params=params
Default routing for Api calls will work as:, (*6)
yoursite.com/api.php?method=Controller.action?params=params
You will also get POST variables in your action arguments, (*7)
Also possible to write aliasses for controller name or action name:, (*8)
Router::alias('buildings', 'Catalog');
Router::actionAlias('all', 'index');
Then /buildings/all url will equal to /catalog/index, (*9)
All information you can find here: https://github.com/follower90/framework-core, (*10)
Shortly about ORM:, (*11)
$obj = Orm::findOne('User', ['name'], ['test'], $params);
$obj->setValue('name', 'test');
Orm::save($obj);
Shortly about Mapper:, (*12)
$mapper = OrmMapper::create('User');
$mapper->setFields(['test', 'name', 'amount']);
->setFilter(['test', 'name', 'amount'], [1,2,3]);
->load();
$users = $mapper->getCollection();
Shortly about Active Record:, (*13)
$users = User::all()->addFilter('type', $id)->load()->getCollection();
$user = User::find($id);
$user->name = 'Peter';
$user->save();
Shortly about QueryBuilder:, (*14)
$query = new QueryBuilder('User');
$query->setBaseAlias('pc')
->select('id', 'title', 'name')
->join('left', 'User_Catalog', 'pc', ['catalog', 'another.id'])
->where('somevalue', [124, 125])
->orderBy('id', 'asc')
->limit(20);
echo $query->composeSelectQuery();
Shortly about SQL helper:, (*15)
MySQL::insert($table, $params); MySQL::update($table, $params, $conditions); MySQL::delete($table, $conditions);
All components and libs for Admin UI you can take here: https://startbootstrap.com/template-overviews/sb-admin-2/, (*16)
Builder supports * git composer for admin and core repositories * recreate db schema * create new object from class * run sql-migrations * launch unit tests, (*17)
To run builder and see help just type in root:, (*18)
./builder
You will create new API endpoints and Contollers in these namespaces: * \App\Api * \App\Controller * \Admin\Api * \Admin\Controller, (*19)
with method
yoursite.com/api.php?method=ControllerName.ActionName yoursite.com/admin/api.php?method=ControllerName.ActionName yoursite.com/admin/controllerName/actionName yoursite.com/controllerName/ActionName
It automatically retrieve to method arguments: * GET parameters * POST parameters * URI-parameters, splitted by slash, (*21)
For example, yoursite.com/admin/page/edit/2 will have key 'edit' with value 2 in \Admin\Controller\Page.methodEdit, (*22)
You can use snippets (reusable html-components) in your admin templates., (*23)
Implement method that will return rendered HTML and just call it in *.phtml file:, (*24)
_snippet('snippetName', [$arg1, $arg2, ...]);
In the templates you should pass all text labels to __ method., (*25)
It will find and output translated value for current user language: 'site_language' in your Config, (*26)
If translation is not existed in your database, it will output entered value and automatically added to translation without value., (*27)
Then you can go to /admin/translation and edit new value., (*28)
<? __('catalog.Name'); ?>