ifacesoft / ice
Ice Open Source PHP Framework
Installs: 5 217
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 5
Forks: 8
Open Issues: 5
Requires
- ifacesoft/ice-cli: 0.0.*
- ifacesoft/ice-http: 0.0.*
- mrclay/minify: 3.0.*
- phpmailer/phpmailer: 6.5.*
- phpoffice/phpspreadsheet: 1.18.*.*
- phpoffice/phpword: 0.18.*
- rybakit/msgpack: 0.8.*
- tarantool/client: 0.9.*
Requires (Dev)
- ccampbell/chromephp: dev-master
- codeception/codeception: 5.0.x-dev
- lox/xhprof: dev-master
- squizlabs/php_codesniffer: dev-master
- 1.27.x-dev
- 1.27.71
- 1.27.70
- 1.27.69
- 1.27.68
- 1.27.67
- 1.27.66
- 1.27.65
- 1.27.64
- 1.27.63
- 1.27.62
- 1.27.61
- 1.27.60
- 1.27.59
- 1.27.58
- 1.27.57
- 1.27.56
- 1.27.55
- 1.27.54
- 1.27.53
- 1.27.52
- 1.27.51
- 1.27.50
- 1.27.49
- 1.27.48
- 1.27.47
- 1.27.46
- 1.27.45
- 1.27.44
- 1.27.43
- 1.27.42
- 1.27.41
- 1.27.40
- 1.27.39
- 1.27.38
- 1.27.37
- 1.27.36
- 1.27.35
- 1.27.34
- 1.27.33
- 1.27.32
- 1.27.31
- 1.27.30
- 1.27.29
- 1.27.28
- 1.27.27
- 1.27.26
- 1.27.25
- 1.27.24
- 1.27.23
- 1.26.x-dev
- 1.26.22
- 1.26.21
- 1.26.20
- 1.26.19
- 1.26.18
- 1.26.17
- 1.26.16
- 1.26.15
- 1.26.14
- 1.26.13
- 1.26.12
- 1.26.11
- 1.26.9
- 1.26.8
- 1.26.7
- 1.26.6
- 1.26.5
- 1.26.4
- 1.26.3
- 1.26.2
- 1.26.1
- 1.26.0
- 1.25.x-dev
- 1.25.44
- 1.25.43
- 1.25.42
- 1.25.41
- 1.25.40
- 1.25.39
- 1.25.38
- 1.25.37
- 1.25.36
- 1.25.35
- 1.25.34
- 1.25.33
- 1.25.32
- 1.25.31
- 1.25.30
- 1.25.29
- 1.25.28
- 1.25.27
- 1.25.26
- 1.25.25
- 1.25.24
- 1.25.23
- 1.25.22
- 1.25.21
- 1.25.20
- 1.25.19
- 1.25.18
- 1.25.17
- 1.25.16
- 1.25.15
- 1.25.14
- 1.25.13
- 1.25.12
- 1.25.11
- 1.25.10
- 1.25.9
- 1.25.8
- 1.25.7
- 1.25.6
- 1.25.5
- 1.25.4
- 1.25.3
- 1.25.2
- 1.25.1
- 1.25.0
- 1.24.x-dev
- 1.24.37
- 1.24.36
- 1.24.35
- 1.24.34
- 1.24.33
- 1.24.32
- 1.24.31
- 1.24.30
- 1.24.29
- 1.24.28
- 1.24.26
- 1.24.25
- 1.24.24
- 1.24.23
- 1.24.22
- 1.24.21
- 1.24.20
- 1.24.19
- 1.24.17
- 1.24.16
- 1.24.15
- 1.24.14
- 1.24.13
- 1.24.12
- 1.24.11
- 1.24.10
- 1.24.9
- 1.24.8
- 1.24.7
- 1.24.6
- 1.24.5
- 1.24.4
- 1.24.3
- 1.24.2
- 1.24.1
- 1.24.0
- 1.0.0
- 0.5.31
- 0.5.30
- 0.5.29
- 0.5.28
- 0.5.27
- 0.5.26
- 0.5.25
- 0.5.24
- 0.5.23
- 0.5.22
- 0.5.21
- 0.5.20
- 0.5.19
- 0.5.18
- 0.5.17
- 0.5.16
- 0.5.15
- 0.5.14
- 0.5.13
- 0.5.12
- 0.5.11
- 0.5.10
- 0.5.9
- 0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- 0.0.0
- dev-master
This package is auto-updated.
Last update: 2024-11-05 23:06:48 UTC
README
Ice is a general purpose PHP-framework. You may fully rely on Ice while developing complex web-applications. Ice key features are the built-in cache support of the main components, flexible configuration and the ability to easily extend existing functionality.
Alternative repository on Bitbacket: Ice (https://bitbucket.org/dp_ifacesoft/ice)
Quick Start Guide
Create a composer.json in the directory workspace/MyProject
mkdir -p workspace/MyProject && cd workspace/MyProject && touch composer.json
workspace - your working directory (logs, caches etc.);
MyProject - the source code of your project
an example file:
{ "name": "vendor/my-project", "description": "My project with Ice", "type": "project", "require": { "ifacesoft/ice": "1.0.*" }, "license": "proprietary", "authors": [ { "name": "dp", "email": "denis.a.shestakov@gmail.com" } ], "minimum-stability": "stable", "config": { "vendor-dir": "../_vendor" }, "scripts": { "post-install-cmd": [ Http ], "post-update-cmd": [ Http ] } }
Install the project using composer
curl -sS https://getcomposer.org/installer | php && php composer.phar install --prefer-source
Configure the web server and /etc/hosts
After successful installation, use the generated configuration.
Ready! Your project should be available at http://myproject.local
The basics
Routes
sample /config/Ice/Core/Route.php:
<?php return [ 'mp_page' => [ 'route' => '/page/{$page}', 'params' => [ 'page' => '(\d)' ], 'weight' => 10000, 'request' => [ 'GET' => [ 'Www:Layout_Main' => [ 'actions' => [ ['Ice:Title' => 'title', ['title' => 'Ice - Open Source PHP Framework ']], 'Www:Index' => 'main' ] ] ] ] ] ]
Important parts:
- 'mp_page' - Route name, (Uses: Route::getInstance('mp_page')->getUrl(20)) returned '/page/20' etc.)
- 'weight' - Priority of matched routes. Greater weight - greater priority.
- 'request' section - Array of available requuest methods (GET, POST etc.)
- 'request/GET' - Only one item (first) contained layout action class as key and params as value
Actions
namespace Mp\Action; use Ice\Core\Action; class Page extends Action { protected static function config() { return [ 'view' => ['viewRenderClass' => 'Ice:Smarty', 'template' => null, 'layout' => null], 'actions' => [], 'input' => [], 'output' => [], 'cache' => ['ttl' => -1, 'count' => 1000], 'access' => [ 'roles' => [], 'request' => null, 'env' => null ] ]; } public function run(array $input) { } }
2 main methods - config and run
method config - return array:
- 'view' - Define way of render output data ('viewRenderClass' - render class, 'template' - template for render, layout - template-wrapper of rendered content in emmet style)
- 'actions' - Child actions
- 'input' - Array of input params with their data providers. Also information of validators, defaults end other.
- 'output' - Фdditional sources of output (params and their data providers as well as 'input' section)
- 'ttl' - time stored in cache (now supported only 3600 :) )
- 'access' - Information to checks permissions to run action (support environment - one of 'production', 'test' or 'development' and request - one of 'cli' or 'ajax')
Models
Select examples:
// 1. $page = Page::getModel(20, ['title', 'desc']); // or Page::getModel(20, '*') // 2. $page = Page::create(['title' => 'page 20')->find([id, 'desc']); // 3. $page = Page::createQueryBuilder()->eq(['desc' => '20th page'])->getSelectQuery()->getModel();
Insert examples:
// 1. Page::create(['title' => 'page 20', 'desc' => '20th page'])->save(); // 2. Page::createQueryBuilder()->getInsertQuery(['title' => 'page 20', 'desc' => '20th page'])->getQueryResult();
Update examples:
// 1. Page::getModel(20, ['title', 'desc'])->set(['title' => 'another title'])->save(); // 2. Page::createQueryBuilder()->eq(['id' => 20])->getUpdateQuery(['title' => 'another title'])->getQueryResult();
Update examples:
// 1. Page::getModel(20, '/pk')->remove(); // 2. Page::createQueryBuilder()->getDeleteQuery(20)->getQueryResult();
Documentation
More info on iceframework.net such as:
Good luck!