https://github.com/michaltaglewski/m-gine
PHP framework
https://github.com/michaltaglewski/m-gine
console-application framework mvc php8 web
Last synced: 3 months ago
JSON representation
PHP framework
- Host: GitHub
- URL: https://github.com/michaltaglewski/m-gine
- Owner: michaltaglewski
- License: bsd-3-clause
- Created: 2022-05-26T14:27:47.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-11T10:40:38.000Z (almost 4 years ago)
- Last Synced: 2026-02-12T12:34:42.742Z (4 months ago)
- Topics: console-application, framework, mvc, php8, web
- Language: PHP
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# M-Gine Framework
## Requirements
* PHP >= 8.0
## Installing via Composer
Create the composer.json file as follows:
```json
{
"require-dev": {
"michaltaglewski/m-gine": "dev-main"
}
}
```
Run the composer installer:
```bash
php composer.phar install
```
Then initiate your first project. See the [M-gine commands](#m-gine-commands) section below.
## M-Gine commands
Right after the composer installation is completed, you are able to use **M-Gine** commands tool.
Execute binary file located in the vendor directory, like following:
```bash
./vendor/bin/mgine help
```
This command should display something similar to:
```bash
$ ./vendor/bin/mgine help
M-Gine commands (0.0.1)
Available commands:
create-project Creates a new project. Usage: project-create [name]
init-project Initializes a new project in current directory. Usage: init-project
create-controller Creates a Controller. Usage: create-controller [name] [namespace]
```
Initiate a project:
```bash
$ ./vendor/bin/mgine init-project
```
## Project Directory Structure
```
config/ framework configuration
controllers/ MVC controllers directory
public/ web public folder (includes index.php)
models/ MVC models directory
tests/ tests of the core framework code
views/ MVC views directory
```
## Configuration
Configure your main web configuration file **config/web.php**:
```php
dirname(__DIR__),
'language' => 'en',
'charset' => 'utf-8',
'components' => [
'urlManager' => require 'urlManager.php',
'db' => require 'db.php'
]
];
```
### Url Manager component
**config/urlManager.php**:
```php
'mgine\web\UrlManager',
'defaultRoute' => 'home/index',
'rules' => [
/**
* Add your URL rules here
* '/' => 'home/index',
* '/about' => 'home/about',
* '/contact' => 'home/contact',
*/
]
];
```
### Database connection
**config/db.php**:
```php
'mgine\db\MysqlConnection',
'dsn' => 'mysql:host=localhost;dbname=my_db_name',
'username' => 'my_db_user',
'password' => 'my_db_user_password',
'charset' => 'utf8',
];
```