https://github.com/ursuleacv/wallaby
A simple lightweight framework for building small apps in PHP
https://github.com/ursuleacv/wallaby
framework micro mvc php simple wallaby
Last synced: 2 months ago
JSON representation
A simple lightweight framework for building small apps in PHP
- Host: GitHub
- URL: https://github.com/ursuleacv/wallaby
- Owner: ursuleacv
- Created: 2017-04-20T18:32:52.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-26T13:29:01.000Z (over 5 years ago)
- Last Synced: 2025-08-16T19:32:13.594Z (8 months ago)
- Topics: framework, micro, mvc, php, simple, wallaby
- Language: PHP
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wallaby
A simple lightweight MVC framework for building small apps in PHP.
Built in support for layouts, themes, routing.
# Usage
Create composer.json file
```json
{
"require": {
"php": ">=5.6.0",
"ext-json": "*",
"ext-pdo": "*",
"ursuleacv/wallaby": "dev-master"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
}
}
```
Run `composer install`
Create a project with the following structure
```
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
```
Example BaseController.php
```php
theme = 'default';
$this->layout = 'layouts/main';
}
}
```
Example HomeController.php
```php
theme = 'default'; // You can override the theme
$this->layout = 'layouts/main';
}
/**
* @return void
*/
public function autoLogin()
{
//
}
}
```
public/index.php
```php
start($url);
```
config/app.php
```php
'My App Name',
'appBaseUrl' => 'http://localhost', // no trailing slash
'theme' => 'default',
'version' => 'v1.0.0',
];
```
config/router.php
this will automatically match all routes with the following format
controller/action/param1/param2
controller/action/?param1=value1¶m2=value2
Ex:
http:localhost/site/register
http:localhost/site/contact
http:localhost/product/edit/123
```php
'index',
'baseController' => 'home',
'errorHandler' => 'home/error',
'routes' => '^(?[a-z-A-Z]+)?/?(?[a-z-A-Z]+)?/?(?.*[a-z0-9/-])?/?(?\?.*)?$',
];
```