Simple, Faster, No Dependence, High Performance PHP framework.
Coder PHP Framework (or simply CPF). It's very very easy to be used, Just Download and Running. No Dependence, No required Composer. You Just need to download and Run on your PHP Server.
- Use CSM structure, Controller(C),Service(S),Model(M)
- Return By Json: {"code":"200", "msg":"success", "data"=[]}
- Strong early warning mechanism (DB, Cache, Script, PHP Error)
- Support ENV file
- Support Middleware
- PHP 7.0 +
- PDO PHP Extension
- Mbstring PHP Extension
git clone https://github.com/wk331100/coder_php_framework.git
- app
- Exception
- Http
- Controllers
- Middleware
- Libs
- Models
- Services
- bootstrap
- app.php
- config
- app.php
- database.php
- logging.php
- public
- index.php
- routes
web.php
- storage
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=coder
DB_USERNAME=coder
DB_PASSWORD=123456
<?php
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->run();
In routes/web.php
file
Route::get('/', 'IndexController@index');
In app/Http/Controllers/IndexController.php
file
<?php
namespace App\Http\Controllers;
use System\Response;
class IndexController extends Controller {
public function index(){
return 'Hello World!';
}
}
In App/Services/UserService.php
file
<?php
namespace App\Services;
use App\Models\UserModel;
class UserService{
public static function getList(){
return UserModel::getInstance()->getList();
}
}
In App/Models/UserModel.php
file
<?php
namespace App\Models;
use System\DB;
class UserModel extends DB {
protected $table = 'user';
private static $_instance;
protected $_pk = 'uid';
public static function getInstance() {
if (!self::$_instance) {
self::$_instance = new self();
}
return self::$_instance;
}
}
{
"code": 200,
"msg" :"Success"
"data": "Hello World"
}
Coder PHP Framework is open source software under the PHP License v3.01