All Projects → Yusfuu → Lightweight-PHP-Framework-For-Web-and-APIs

Yusfuu / Lightweight-PHP-Framework-For-Web-and-APIs

Licence: MIT license
Simple PHP framework that helps you quickly understand and write simple APIs.

Programming Languages

PHP
23972 projects - #3 most used programming language
hack
652 projects
CSS
56736 projects

Projects that are alternatives of or similar to Lightweight-PHP-Framework-For-Web-and-APIs

startmvc
超轻量php框架 lightweight php framework
Stars: ✭ 25 (+4.17%)
Mutual labels:  mvc, php-framework
Koseven
Koseven a Kohana fork compatible with PHP7
Stars: ✭ 332 (+1283.33%)
Mutual labels:  mvc, php-framework
Bingo-Framework
MVC framework for PHP
Stars: ✭ 15 (-37.5%)
Mutual labels:  mvc, php-framework
OwOFrame
A lightweight MVC framework for PHP
Stars: ✭ 46 (+91.67%)
Mutual labels:  mvc, php-framework
Leaf
🍁 The easiest way to create clean, simple but powerful web apps and APIs quickly
Stars: ✭ 248 (+933.33%)
Mutual labels:  mvc, php-framework
leafMVC
MVC "Framework" created from Leaf PHP Framework
Stars: ✭ 25 (+4.17%)
Mutual labels:  mvc, php-framework
miniPHP
A small, simple PHP MVC framework skeleton that encapsulates a lot of features surrounded with powerful security layers.
Stars: ✭ 147 (+512.5%)
Mutual labels:  mvc, php-framework
W
Framework pédagogique de la WebForce3
Stars: ✭ 10 (-58.33%)
Mutual labels:  mvc, php-framework
Php Msf
PHP微服务框架即Micro Service Framework For PHP
Stars: ✭ 1,764 (+7250%)
Mutual labels:  mvc, php-framework
Miniphp
A small, simple PHP MVC framework skeleton that encapsulates a lot of features surrounded with powerful security layers.
Stars: ✭ 144 (+500%)
Mutual labels:  mvc, php-framework
PHPFlask
🍶 Flask for PHP
Stars: ✭ 15 (-37.5%)
Mutual labels:  mvc, php-framework
velox
The minimal PHP micro-framework.
Stars: ✭ 55 (+129.17%)
Mutual labels:  mvc, php-framework
Imi
imi 是基于 Swoole 的 PHP 协程开发框架,它支持 Http、Http2、WebSocket、TCP、UDP、MQTT 等主流协议的服务开发,特别适合互联网微服务、即时通讯聊天im、物联网等场景!。QQ群:17916227
Stars: ✭ 680 (+2733.33%)
Mutual labels:  mvc, php-framework
fir
Fir. A lightweight PHP MVC Framework.
Stars: ✭ 33 (+37.5%)
Mutual labels:  mvc, php-framework
Polyel-Framework
⚡️ Voltis Core: A PHP framework based on Swoole from the ground up
Stars: ✭ 22 (-8.33%)
Mutual labels:  mvc, php-framework
aquiver
🚀 The aquifer is a java web framework based on Java8 and netty
Stars: ✭ 38 (+58.33%)
Mutual labels:  mvc
QuickCore
Delphi Core Framework to fast build desktop/mobile/web apps.
Stars: ✭ 84 (+250%)
Mutual labels:  mvc
PHP MVC LightweightFramework
【停更】PHP_MVC_API作为一个极其轻量级MVC&API开发框架,不断吸取参考了flight、phx、discuz、punbb等开源项目的优点,最终形成独具自己风格的快速开发框架。适合微小型项目,目前我主要用于服务端应用程序接口开发,提供API和移动APP进行数据交换。推荐使用https://github.com/phalapi/phalapi
Stars: ✭ 16 (-33.33%)
Mutual labels:  mvc
Samples-ASP.NET-MVC-CSharp
ASP.NET MVC C# samples for Stimulsoft Reports.Web reporting tool.
Stars: ✭ 31 (+29.17%)
Mutual labels:  mvc
organiser
An organic web framework for organized web servers.
Stars: ✭ 58 (+141.67%)
Mutual labels:  mvc

Lightweight PHP Framework For Web and APIs

PHP framework that helps you write quickly simple but powerful web apps and APIs

Installation

Use the package manager composer to install required files

Install dependencies

composer install

Hello World

file routes/api.php

<?php

use App\Http\Request;
use App\Routing\Route;

/*
|------------------------------------------------------------------
| API Routes
|------------------------------------------------------------------
|
| Here is where you can register API routes for your application. 
|
*/

Route::get('/hello/{name}', function (Request $request) {
  $name = $request->params->name;
  echo ("Hello, $name");
});

file routes/web.php

<?php

use App\Http\Request;
use App\Routing\Route;
use function App\lib\view;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application.
|
*/

Route::get('/', function (Request $request) {
  return view('welcome', ['lang' => 'PHP']);
});

Available Router Methods

The router allows you to register routes that respond to any HTTP verb:

Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::delete($uri, $callback);

PHP built-in server

Run the following command in terminal to start localhost web server, assuming ./public/ is public-accessible directory with index.php file:

cd public/
php -S localhost:8000
Going to http://localhost:8000/api/hello/world will now display "Hello, world".
Going to http://localhost:8000/ will render the welcome page.

Example Controller

<?php

namespace App\Controllers;

use App\Http\Request;

class ExampleController extends Controller
{

  /**
   * Display a listing of the resource.
   *
   * @return \Http\Request
   */
  public static function index(Request $request)
  {
    //
  }

  /**
   * Store a newly created resource in storage.
   *
   * @param  \Http\Request  $request
   */
  public static function store(Request $request)
  {
    //
  }

  /**
   * Display the specified resource.
   *
   * @param  \Http\Request  $request
   */
  public static function show(Request $request)
  {
    //
  }

  /**
   * Update the specified resource in storage.
   *
   * @param  \Http\Request  $request
   */
  public static function update(Request $request)
  {
    //
  }

  /**
   * Remove the specified resource from storage.
   *
   * @param  \Http\Request  $request
   */
  public static function destroy(Request $request)
  {
    //
  }
}

Example Model

<?php

namespace App\Models;

class ExampleModel extends Model
{
  /**
   * @var array
   */
  protected $fillable = [];
}

Documentation

Documentation

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].