Lightweight PHP Framework For Web and APIs
stable apis
PHP framework that helps you write quickly simple but powerful web apps and APIs
Use the package manager composer to install required files
Install dependencies
composer installfile routes/api.php
<?php
use AppHttpRequest;
use AppRoutingRoute;
/*
|------------------------------------------------------------------
| 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 AppHttpRequest;
use AppRoutingRoute;
use function Applibview;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application.
|
*/
Route::get('/', function (Request $request) {
return view('welcome', ['lang' => 'PHP']);
});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);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<?php
namespace AppControllers;
use AppHttpRequest;
class ExampleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return HttpRequest
*/
public static function index(Request $request)
{
//
}
/**
* Store a newly created resource in storage.
*
* @param HttpRequest $request
*/
public static function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param HttpRequest $request
*/
public static function show(Request $request)
{
//
}
/**
* Update the specified resource in storage.
*
* @param HttpRequest $request
*/
public static function update(Request $request)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param HttpRequest $request
*/
public static function destroy(Request $request)
{
//
}
}<?php
namespace AppModels;
class ExampleModel extends Model
{
/**
* @var array
*/
protected $fillable = [];
}Documentation
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT