PHP code example of ifacesoft / ice

1. Go to this page and download the library: Download ifacesoft/ice library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ifacesoft / ice example snippets



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'
                    ]
                ]
            ]
        ]
    ]
]    

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)
    {
    }
}

// 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();

// 1. 
Page::create(['title' => 'page 20', 'desc' => '20th page'])->save();
// 2.
Page::createQueryBuilder()->getInsertQuery(['title' => 'page 20', 'desc' => '20th page'])->getQueryResult();

// 1. 
Page::getModel(20, ['title', 'desc'])->set(['title' => 'another title'])->save();
// 2.
Page::createQueryBuilder()->eq(['id' => 20])->getUpdateQuery(['title' => 'another title'])->getQueryResult();

// 1. 
Page::getModel(20, '/pk')->remove();
// 2.
Page::createQueryBuilder()->getDeleteQuery(20)->getQueryResult();
shell
curl -sS https://getcomposer.org/installer | php && php composer.phar install --prefer-source