zems / munlite
Munlite is lite weight php framework
v1.0.1
2026-05-14 12:37 UTC
README
Munlite is a PHP framework. It's a light weight framework. Ideal for Headless CMS.
Query Builder Examples (Content Model)
Get All Records
Content::get();
Find by ID
Content::find(1); Content::where('id', 1)->first();
Select Specific Columns
Content::select('id', 'title', 'details')->get();
Where Condition
Content::where('status', 1)->get(); Content::where('type', '=', 'news')->get();
Multiple Where Conditions
Content::where('status', 1)->where('type', 'news')->get();
Or Where
Content::where('status', 1)->orWhere('type', 'blog')->get();
Where In
Content::whereIn('id', [1, 2, 3, 4, 5])->get(); Content::whereIn('type', ['news', 'blog'])->get();
Where Between
Content::whereBetween('id', [1, 10])->get();
Order By
Content::orderBy('id', 'DESC')->get(); Content::where('status', 1)->orderBy('title', 'ASC')->get();
Group By
Content::select('type', 'COUNT(*) as total')->groupBy('type')->get();
Limit & Offset (Pagination)
Content::orderBy('id', 'DESC')->limit(10)->offset(0)->get();
Join
User::select('user.id', 'user.name', 'content.title') ->leftJoin('content', 'user.id', '=', 'content.user_id') ->get();
Aggregate Functions
Content::count(); Content::count('id'); Content::where('status', 1)->count(); Content::max('id'); Content::min('id'); Content::avg('id'); Content::sum('id');
Create Record
Content::create([ 'title' => 'New Post', 'details' => 'Content details here', 'type' => 'news', 'status' => 1 ]);
Update Record
Content::where('id', 1)->update([ 'title' => 'Updated Title', 'details' => 'Updated details' ]); Content::where('status', 0)->update([ 'status' => 1 ]);
Delete Record
Content::where('id', 1)->delete(); Content::where('status', 0)->delete();
Chained Example
Content::select('id', 'title', 'details') ->where('status', 1) ->whereIn('type', ['news', 'blog']) ->orderBy('id', 'DESC') ->limit(10) ->get();
Raw Queries in whereIn/whereBetween
Content::whereIn('id', [1, 2, 3])->get(); Content::orWhereIn('id', [4, 5, 6])->get(); Content::whereBetween('id', [1, 10])->get();