Giter Site home page Giter Site logo

m-gine's Introduction

M-Gine Framework

Requirements

  • PHP >= 8.0

Installing via Composer

Create the composer.json file as follows:

{
    "require-dev": {
        "michaltaglewski/m-gine": "dev-main"
    }
}

Run the composer installer:

php composer.phar install

Then initiate your first project. See the 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:

./vendor/bin/mgine help

This command should display something similar to:

$ ./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:

$ ./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

return [
    'basePath' => dirname(__DIR__),
    'language' => 'en',
    'charset' => 'utf-8',
    'components' => [
        'urlManager' => require 'urlManager.php',
        'db' => require 'db.php'
    ]
];

Url Manager component

config/urlManager.php:

<?php

return [
    'class' => '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

return [
    'class' => 'mgine\db\MysqlConnection',
    'dsn' => 'mysql:host=localhost;dbname=my_db_name',
    'username' => 'my_db_user',
    'password' => 'my_db_user_password',
    'charset' => 'utf8',
];

m-gine's People

Contributors

michaltaglewski avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.