PHP code example of ursuleacv / wallaby

1. Go to this page and download the library: Download ursuleacv/wallaby 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/ */

    

ursuleacv / wallaby example snippets




namespace App\Controllers;

use Wallaby\Base\Controller;

class BaseController extends Controller
{
    /**
     *
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();

        $this->theme = 'default';
        $this->layout = 'layouts/main';
    }
}



namespace App\Controllers;

class HomeController extends BaseController
{
    /**
     *
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();

        $this->theme = 'default'; // You can override the theme
        $this->layout = 'layouts/main';
    }

    /**
     * @return void
     */
    public function autoLogin()
    {
        //
    }
}


date_default_timezone_set('UTC');



use Wallaby\Router;

error_reporting(-1);

defined('ROOT') or define('ROOT', __DIR__);
defined('PUBLIC_DIR') or define('PUBLIC_DIR', 'public');

$config = $configRouter = 


    return [
        'appName' => 'My App Name',
        'appBaseUrl' => 'http://localhost', // no trailing slash
        'theme' => 'default',
        'version' => 'v1.0.0',
    ];


    return [
        'baseAction' => 'index',
        'baseController' => 'home',
        'errorHandler' => 'home/error',
        'routes' => '^(?<controller>[a-z-A-Z]+)?/?(?<action>[a-z-A-Z]+)?/?(?<parameter>.*[a-z0-9/-])?/?(?<query>\?.*)?$',
    ];

app
    Controllers
        BaseController.php
        HomeController.php
    Models
        User.php
config
    router.php
    app.php
public
    themes
        default
            views
                home
                    index.php
                    login.php
                layouts
                    main.php
        beta
            views
    index.php
server.php