Skip to content

ibnsultan/mimosa

Repository files navigation

Mimosa

A minimalist php + reactJS framework

It is designed to seamlessly integrate PHP and ReactJS without the need for complete separation between frontend and backend layers.

composer create-project ibnsultan/mimosa YOUR_PROJECT_NAME

Structure

📁 project/
├── 📁 app/
|   ├── 📁 console/
│   ├── 📁 controllers/
│   ├── 📁 lib/
│   ├── 📁 routes/
│   ├── 📁 views/
│   │   ├── 📁 ScreenName/
│   │   └── 📁 Layouts/
│   └── 🐘 Controller.php
├── 📁 config/
├── 📁 public/
│   └── 📄 index.php
├── 📁 vendor/
├── ⚙️ .env
├── ⚙️ .htaccess
├── 📎 composer.json
├── 🐘 index.php
└── 📄 mimic

Features

  • Exceptions and Error Handler
  • HTTP Utils (Routing, Response, Requests)
  • Autoloading
  • Authorization & Authentication (Beta)
    • Login and Registration
    • Session based authentication
    • Token Based authentication (For API request)
    • Pasword Reset Implentation
  • Database
    • Models
    • Migrations

Basic Usage

Mimosa is insanely easy to use due to its simplistic and minimalistic design, it already comes in with some basic components implemented in it like routing, a way handle and render requests and responses respectively

Routing

All routes are preload in the app/routes directory thefore any file defined in routes would automatically be loaded into your application

Basic Routing

app->get('/', function(){
  echo 'hello world!';
});

Routing with a Class

app->get('/', 'MyController@index');

Response

Markup

response()->markup('<h1>Hello</h1>');

Json

response()->json([
  'status' => 'success',
  'data' => 'Hello',
]);

With Header

response()->withHeader('key', 'value')->json([
  'status' => 'success',
  'data' => 'Hello',
]);

Other Methods

Responce comes with other methods like plain, xml, page, download etc

Request

The request object provides an interface for accessing and manipulating the current HTTP request being handled by your application, as well as retrieving input, cookies, and files that were submitted with the request.

request()->get('key');

The request method in request works with all request methods, whether it's get, post or file, it can even get multiple values at once or even suplements a defualt when the value is null.

Multiple

$data = request()->get(['username', 'password']);

// results: array( 'username' => 'value', 'password' => 'value' )

Some other request methods include file, param, try, rawData etc

Documentation

More will be covered in the Documentation section which is still in preparation, keep your eyes on the wiki section

Contributions

Opinions, suggestion, pull requests, and anything of value

About

Mimosa is a PHP+ReactJS framework designed to seamlessly integrate PHP and ReactJS without the need for complete separation between frontend and backend layers.

Resources

Stars

Watchers

Forks

Packages

No packages published