2017 © Pedro Peláez
 

library mikasa

A Simple Model-View-Controller(MVC) PHP Framework

image

philiplambok/mikasa

A Simple Model-View-Controller(MVC) PHP Framework

  • Friday, August 11, 2017
  • by philiplambok
  • Repository
  • 1 Watchers
  • 3 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Mikasa Framework

Packagist, (*1)

Mikasa!, (*2)

Mikasa Framework is A Simple MVC(Model View Controller) PHP Framework. Mikasa Framework is suitable with you who familiar with CodeIgniter or just new in this pattern., (*3)

Installation

You need to install xampp with >= php 5.6 and composer. The installation we have to option, you can just download or clone this repo., (*4)

$ git clone https://github.com/philiplambok/mikasa.git
$ cd mikasa

or you can install with composer [Recomended], (*5)

$ composer create-project philiplambok/mikasa myapp --prefer-dist -vvv
$ cd myapp

or just download from stable releases, (*6)

Usage

In MVC Pattern, you will familliar with Model (Class that interact with database), View (File that handle the UI) and Controller (Class that manage the logic and routing)., (*7)

You can run the project using build in php server, with type this command :, (*8)

$ php -S localhost:8000

That command will be running your code in localhost port 8000. You can open your browser and type to url box : http://localhost:8000, (*9)

Controller

Here is an example of a basic controller., (*10)

<?php 

namespace App\Controllers;
use App\Core\Controller;

class HomeController extends Controller 
{
    public function index()
    {
        return $this->view('welcome');
    }
} 

All controller must be extends with class controller, and for using class controller you must use from namespace : use App\Core\Controller. Like i said first, in mikasa framework, controller will be manage the route like CodeIgniter, so on that code will be running in 'http://localhost:8000'. yeah index() method is the default method., (*11)

Model

If your program need some logic or interact to database, you can just create the model., (*12)

<?php 

namespace App\Models;
use App\Core\Database;

class User extends Database
{
    public $username;

    // get all user in users table.
    public function getList()
    {
      $sql = 'SELECT * FROM users ORDER BY id';
      $query = $this->db->query($sql);
      $result = $query->fetchAll(PDO::FETCH_OBJ);
      return $result;
    }
}

All model will be extends with Database class. To connection with database, you can using query method in db attr: $this->db->query("query")., (*13)

Views

All views located in dir : App/Views. You can create some html file and show them with controller. If you need some data in database you just create the model., (*14)

Learning Resource

  • Documentation (Comming Soon!)

The Versions

11/08 2017

dev-master

9999999-dev

A Simple Model-View-Controller(MVC) PHP Framework

  Sources   Download

30/06 2017

1.0

1.0.0.0

A Simple Model-View-Controller(MVC) PHP Framework

  Sources   Download