PHPackages                             ushergodwin/razer-framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. ushergodwin/razer-framework

ActiveLibrary[Framework](/categories/framework)

ushergodwin/razer-framework
===========================

Razer is a PHP framewrok that provides a convenient MVC (Model View Controller) structure for robust systems development

v1.1.3(4y ago)35MITJavaScriptPHP &gt;= 7.4

Since Aug 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ushergodwin/razer)[ Packagist](https://packagist.org/packages/ushergodwin/razer-framework)[ RSS](/packages/ushergodwin-razer-framework/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (6)Used By (0)

Razer FRAMEWORK
===============

[](#razer-framework)

- Razer is a PHP Framework that provides a convenient MVC (Model, View Controller) structure for systems development.
- Do you want something small but yet powerfull, this is your best choice

Table of contents
=================

[](#table-of-contents)

Database
--------

[](#database)

1. [Insert](#insert-one--many)
2. [Update](#update-a-record)
3. [Delete](#delete-a-record)
4. [Truncate](#truncate-the-whole-table)
5. [Affected Rows](#affected-rows)
6. [Fetch Data](#fetch-all)
7. [Join Tables](#join-tables)
8. [Eloquent Models](#eloquent-models)
9. [Migrations](#migrations)

HTTP
----

[](#http)

1. [Request](#requests)
2. [Response](#response)
3. [Redirect](#redirect)
4. [Routing](#routes)

Insert one / Many
-----------------

[](#insert-one--many)

// For many, supply an array of arrays of data. `DB::table('table_name')->save($data);`

Last Insert Id
--------------

[](#last-insert-id)

`DB::lastId();`

Update a record
---------------

[](#update-a-record)

`DB::table('table_name')->where('id', 1)->update($data);`

Delete a record
---------------

[](#delete-a-record)

`DB::table('table_name')->where('id', 1)->delete();`

Truncate the whole table
------------------------

[](#truncate-the-whole-table)

`DB::table('table_name')->delete();`

Affected Rows
-------------

[](#affected-rows)

`DB::affectedRows();`

Fetch all
---------

[](#fetch-all)

`DB::table('table_name')->get();` // returns all columns

Fetch specific columns
----------------------

[](#fetch-specific-columns)

`$columns = 'column1, column2, column3 columnn'` //as a string

OR

`$columns = ['column1', 'column2', 'column3', 'columnn']` // as an array `DB::table('table_name')->get($columns);`

Fetch all columns with a condition
----------------------------------

[](#fetch-all-columns-with-a-condition)

`DB::table('table_name')->where('id', 1)->get();`

Fetch all columns with multiple conditions
------------------------------------------

[](#fetch-all-columns-with-multiple-conditions)

// multiple call to the where method creates WHERE AND AND AND ... // call orWhere to and an OR `DB::table('table_name')->where('id', 1) ->where('age', 20 , '>')->where('gender', 'Male')->get();`

Fetch one row with a condition
------------------------------

[](#fetch-one-row-with-a-condition)

`DB::table('table_name')->row()->where('id', 1)->get();`

OR

`DB::table('table_name')->find(1);` // default column name is 'id'

Fetch one value
---------------

[](#fetch-one-value)

`DB::table('table_name')->where('id', 1)->value();`

Count number of rows
--------------------

[](#count-number-of-rows)

`DB::table('table_name')->where('id', 1)->count();``DB::table('table_name')->count();` // all rows without a condition

Max / Min / Average value
-------------------------

[](#max--min--average-value)

`DB::table('table_name')->where('id', 1)->max();``DB::table('table_name')->where('id', 1)->min();``DB::table('table_name')->where('id', 1)->avg();`

Select distict values
---------------------

[](#select-distict-values)

`DB::table('table_name')->distinct()->get();` // supply columns if not all // distinct with a condition `DB::table('table_name')->distinct()->where('id', 1)->get();`

Join tables
-----------

[](#join-tables)

`DB::table('table_name')->join('table2', 'table1.primary', 'table2.foregin')->get();`

// call the join method multiple times to join mutliple tables using INNER JOIN. Other options of join methods include `leftJoin(), rightJoin,() unionJoin()`

Select with a Between clause
----------------------------

[](#select-with-a-between-clause)

`DB::table('table_name')->between('age', 20, 25)->get();`

Select data for pagenation
--------------------------

[](#select-data-for-pagenation)

`DB::table('table_name')->range(1, 25)->get();`

Check if the record exists
--------------------------

[](#check-if-the-record-exists)

`DB::table('table_name')->where('id', 1)->exits();` // retuns true if exists

Check if the record does not exist
----------------------------------

[](#check-if-the-record-does-not-exist)

`DB::table('table_name')->where('id', 1)->doesNotExist();` // oposite of exist

Use a different database before querying
----------------------------------------

[](#use-a-different-database-before-querying)

`Database::switchTo('database_name');`// start querying from here

Use a different database when querying
--------------------------------------

[](#use-a-different-database-when-querying)

`DB::table('table_name')->use('database_name', 'table')->get();`

Eloquent Models
===============

[](#eloquent-models)

- You can extend the Model class to you have you model called on its corresponding table name.
- The Model name should be singular and the table name in plural form
- The Eloquent model will convert your model name from singular to plural before querying the model objects.

Insert
------

[](#insert)

`$interns = new Intern($data); $interns->save();`

Affected Rows
-------------

[](#affected-rows-1)

`$interns->affectedRows();`

Last Insert Id
--------------

[](#last-insert-id-1)

`$interns->lastId();`

Magic assignment for inserting
------------------------------

[](#magic-assignment-for-inserting)

`$interns = new Intern(); $interns->name = "Godwin"; $interns->age = 20; $inters->save();`

Update a model
--------------

[](#update-a-model)

`Intern::find(1)->update($data);`

Delete a resource
-----------------

[](#delete-a-resource)

`Intern::find(5)->delete();`

Fecth all
---------

[](#fecth-all)

`Intern::all();` // same as `DB::table('interns')->get();`

Fetch all with a condition
--------------------------

[](#fetch-all-with-a-condition)

`Intern::where('id', 1)->get();` // same `DB::table('interns')->where('id', 1)->get();`

Fetch one
---------

[](#fetch-one)

`Intern::find(1);`

Join models
-----------

[](#join-models)

`Intern::with('course')->get();` // this will assume that the interns and courses table use the Id column as its primary key, forming INNER JOIN courses ON interns.course\_id = courses.id

Join using the query builder
----------------------------

[](#join-using-the-query-builder)

`Interns::with('course')->join('supervisor', 'interns.supervisor_id', 'supervisor.id')->get();`

Execute a custom query
----------------------

[](#execute-a-custom-query)

`DB::query('SELETE * FROM interns WHERE age > ?')->bindings([20])->get();`

- Only queries with bindings are executed with the query method

Migrations
==========

[](#migrations)

---

Create Database: | `php manage make:db` if the database name is not specified in the .env configurations, use `php manage make:db dbname`
-----------------------------------------------------------------------------------------------------------------------------------------

[](#create-database-----------------------php-manage-makedb-if-the-database-name-is-not-specified-in-the-env-configurations-use-php-manage-makedb-dbname)

Make Migration: | `php manage make:migration create_migration_name` This will create a migrations file under database/migrations directory. (tables names should be in a plural form)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#make-migration------------------------php-manage-makemigration-create_migration_name-this-will-create-a-migrations-file-under-databasemigrations-directory-tables-names-should-be-in-a-plural-form)

RunAll Migrations: | `php manage migrate` This will run all migrations
----------------------------------------------------------------------

[](#runall-migrations---------------------php-manage-migrate-this-will-run-all-migrations)

Migration a specific file: | `php manage migrate --file=filename` This will run migations for a single file. (do not put the file extension)
--------------------------------------------------------------------------------------------------------------------------------------------

[](#migration-a-specific-file-------------php-manage-migrate---filefilename-this-will-run-migations-for-a-single-file-do-not-put-the-file-extension)

Group Migrations into 1 sql file | `php manage migrate:group` All migration files will be grouped into one sql file
-------------------------------------------------------------------------------------------------------------------

[](#group-migrations-into-1-sql-file-------php-manage-migrategroup-all-migration-files-will-be-grouped-into-one-sql-file)

Run grouped migration: | `php mange migrate:group --run` This will run grouped migrations
-----------------------------------------------------------------------------------------

[](#run-grouped-migration-----------------php-mange-migrategroup---run-this-will-run-grouped-migrations)

Run Migartion modifications | `php manage migrate:modifiy` This will run migration modifications
------------------------------------------------------------------------------------------------

[](#run-migartion-modifications------------php-manage-migratemodifiy-this-will-run-migration-modifications)

List Migrations: | `php manage migrate:list` Lists all run migrations
---------------------------------------------------------------------

[](#list-migrations-----------------------php-manage-migratelist-lists-all-run-migrations)

Drop Migrations: | `php manage migrate:rollback` Rolls back migrations
----------------------------------------------------------------------

[](#drop-migrations-----------------------php-manage-migraterollback-rolls-back-migrations)

Drop and re-run migrations: | `php manage migrate:refresh` Rools back and re-runs migrations
--------------------------------------------------------------------------------------------

[](#drop-and-re-run-migrations------------php-manage-migraterefresh-rools-back-and-re-runs-migrations)

Show Migration logs/errors: | `php manage migrate:log` Logs Migrations errors
-----------------------------------------------------------------------------

[](#show-migration-logserrors------------php-manage-migratelog-logs-migrations-errors)

Clear Migration logs/errors: | `php manage migrate:log --clear` Clears migrations errors
----------------------------------------------------------------------------------------

[](#clear-migration-logserrors-----------php-manage-migratelog---clear-clears-migrations-errors)

Controllers and Models
======================

[](#controllers-and-models)

Case; All Controllers and Models should use CamelCase and should be in singular form
------------------------------------------------------------------------------------

[](#case-all-controllers-and-models-should-use-camelcase-and-should-be-in-singular-form)

---

Make Controller: | `php manage make:controller ControllerName`

- //in singular Will create a controller under app/Controller/
- The resource controller is created with methods, index, create, store, show, edit, update, and destroy

---

Make a Resource Controller: | `php manage make:controller ControllerName --resource`

- // Creates a resource controller with CRUD methods

---

Make Model: | `php manage make:model ModelName`

- // in singular Creates a model under app/Models

---

Make Model and its migration: | php manage make:model -M ModelName

- // in singular

---

Template
========

[](#template)

---

Clear Cache: | php manage cache:clear
-------------------------------------

[](#clear-cache---------------------------php-manage-cacheclear)

- For more information or inquiries, please call
- +256 754438448 OR
- Email

Requests
========

[](#requests)

- All methods that receive data through an HTTP POST request should have a $request paramater
- HTTP POST
    ---------

    [](#http-post)

` public function saveUser(Request $request) { $name = $request->post('name'); // get the value of name sent through an HTTP POST echo $name; }`

// OR ` public function saveUser(Request $request) { $name = $request->name; //dynamically assigned properties the Request Class echo $name; }`

// OR `public function saveUser(Request $request) { $name = $request->body->name; //dynamically assigned properties the Request Class echo $name; }`

- HTTP GET
    --------

    [](#http-get)

` public function saveUser(Request $request) { $name = $request->get('name'); // get the value of name sent through an HTTP GET echo $name; }`

// OR `public function saveUser(Request $request) { $name = $request->name; echo $name; }`

// OR `public function saveUser(Request $request) { $name = $request->params->name; echo $name; }`

Response
========

[](#response)

The response class has 2 methods, ie send and json. Send() send a plain text response while json send a json formated respeonse.

- Both methods have 2 parameters

1. status --&gt; http status code. Supported status codes are 200,202,302, 400, 401, 402, 403, 404, 408, 422, 500, 502
2. Message --&gt; text / json reponse to send.

- HTTP Plain text response
    ------------------------

    [](#http-plain-text-response)

`public function login(Request $request) { $email = $request->post('email'); return response()->send(200, $email); }`

- HTTP JSON response
    ------------------

    [](#http-json-response)

`public function login(Request $request) { $email = $request->post('email'); return response()->json(200, $email); // can be received through the message property }`

Redirect
========

[](#redirect)

`redirect('user/dashboard');`

- Redirect back `redirect()->back();`

Routes
======

[](#routes)

- The Routes class has 6 methods, get, post, group, except, name. and resource
- GET
    ---

    [](#get)
- The get and post methods takes 2 arguements, $url (the url to go to) and $callback, an array of controller name and its method
- Simple get route `Route::get('user/profile', [UserController::class, 'userProfile']);`
- POST
    ----

    [](#post)
- Simple get route `Route::post('user/profile', [UserController::class, 'userProfile']);`
- GROUP
    -----

    [](#group)
- Takes in 2 arguments, $prefix (array), $callback (closure)
- `Route::group(['prefix' => 'admin', function(){ Route::get('/dashboard', [AdminController::class, 'index']); });` in the template ` &lt;a href='{{ url('admin/dashboard') }}'&gt;Dashboard
- Resource
    --------

    [](#resource)
- This Route method is used to create routes for resource controllers
- `Route::resource('products', ProductController::class);` // products is the prefix of the route
- The above creates the following routes
- /products (GET)
- /products (PUT)
- /products/create (GET)
- /products/product\_id (GET)
- /products/product\_id/edit (GET)
- /products/product\_id (DELETE)
- /products/store (POST)
- Except
    ------

    [](#except)
- You can call the except method to ignore the specified class methods when creating routes `Route::resource('products', ProductController::class)->except(['destroy']);`
- name
    ----

    [](#name)
- On top of get and post methods, you can call the name method and register a short route name to use. This name must be used within the route method
- In routes `Route::post('user/profile', [UserController::class, 'userProfile'])->name('user.p');`
- In the template ` Dashboard` // takes you to user/profile

End
---

[](#end)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~71 days

Total

5

Last Release

1464d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b084e623d67d2e9e8261f18ba5bd98111a29bdc6a7e8174a5544c76905828a32?d=identicon)[ushergodwin](/maintainers/ushergodwin)

---

Top Contributors

[![ushergodwin](https://avatars.githubusercontent.com/u/65310616?v=4)](https://github.com/ushergodwin "ushergodwin (34 commits)")

---

Tags

phpphp-frameworkphpframeworksqlbluefacesraser

### Embed Badge

![Health badge](/badges/ushergodwin-razer-framework/health.svg)

```
[![Health](https://phpackages.com/badges/ushergodwin-razer-framework/health.svg)](https://phpackages.com/packages/ushergodwin-razer-framework)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
