ibnsultan / mimosa
a minimalistic PHP+reactJS Combo
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 0
Type:project
Requires
- ibnsultan/whoops: dev-master
- illuminate/database: ^10.47
- jenssegers/blade: ^2.0
- leafs/router: ^0.2.3
- vlucas/phpdotenv: ^5.6
README
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