PHPackages                             nabeelalihashmi/lightframework - 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. nabeelalihashmi/lightframework

ActiveLibrary[Framework](/categories/framework)

nabeelalihashmi/lightframework
==============================

Module PHP Framework Base

v1.0.0(4y ago)14MITPHP

Since Jun 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/nabeelalihashmi/LightFramework)[ Packagist](https://packagist.org/packages/nabeelalihashmi/lightframework)[ RSS](/packages/nabeelalihashmi-lightframework/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

[![LightFramework](./docs/header.png)](./docs/header.png)

LightFramework
==============

[](#lightframework)

Framework to Make Framework
---------------------------

[](#framework-to-make-framework)

LightFramework is a minimal library to make your own framework according to your needs. You can use any component, like Router, Cache etc and Register them. LightFramework also provided functionality for `deferred calling`. `Deferred` functions are called at end based on priority.

About Author
------------

[](#about-author)

[Nabeel Ali](https://iconiccodes.com) |  |

Motivation
----------

[](#motivation)

A framework enables developer to write managable code and makes it easy for them to manage the code. But problem is that most frameworks are bloated. They have the features you don't require. That makes not suitable for small projects and causes fall in performance.

For Example

- You require only Router and Database for API. You can use LightFramework and install only Routing and Database plugins. No bloatware of email library, hashing libraries etc.
- You want a static website. You can use Router only.
- You want a website with dynamic content, You can use Router and Template Engine.

Features
--------

[](#features)

```
* Easy
* Very minimum code for initialization.
* Deferred calls
* Call deffered calls prematurely when required.
* Add callables as plugin

```

Installtion
-----------

[](#installtion)

Install via Composer

```
composer require nabeelalihashmi/LightFramework

```

Or Download the class and use own autoloading function.

Usage
-----

[](#usage)

- Create new instance of LightFramework It requires 4 arguments
    - `config`: Path of directory where configuration files are stored.
    - `autoload` : Path of directory where files for autoloading are stored.
    - `global_symbol` : The symbol from which instance of LightFramework will be asscessable globally. Default is `__`

Example:

```
$light = new LightFramework('config', 'autoload', '__');

```

- Plugin the modules. with `plugModule()` method. It requires 3 arguments

- `key`: The name of the plugin module which will accessed later using `$light->getModule($key)`
- `callable`: the callable plugin
- `callback`: the callback called by framework when object is loaded.

Example:

```
$demo = new Demo(10, 20);
$light->pluginModule('demo', $demo, function($demo) {
  $demo->showMessage();
});

```

- Initiate the Framework

```
$light->init();

```

NOTE
----

[](#note)

When `init` is called, first autoload libs in autoload direcotry all loaded. After that plugin in autoload\_module.config.php file are loaded.

Methods
-------

[](#methods)

getVersion
----------

[](#getversion)

- Get version of the LightFramework

```
public static function getVersion()

```

- Constructor
- string $config\_dir
- string $autoload\_dir
- string $global\_symbol

```
public function __construct($config_dir = 'config', $autoload_dir = 'autoload', $global_symbol = '__')

```

instance
--------

[](#instance)

- Returns the instance of framework if constructor is called otherwise thrrows exception
- returns self
- @throws Exception

```
public static function instance()

```

defer
-----

[](#defer)

- Defer the call to run at the end of exection or when runDefered() is called
- integer $id
- callable $callback
- returns void

```
public function defer(int $id, callable $callback)

```

init
----

[](#init)

- Initiate the function
- returns void

```
public function init()

```

runDeferred
-----------

[](#rundeferred)

- Run the deffered calls. If second argument is set to false, the calls are not removed from list. If calls
- are prematurely called, then at end of execution they will be called again.
- array $ids
- boolean $remove\_upon\_calling
- returns void

```
public function runDeferred($ids = [], $remove_upon_calling = true)

```

plugModule
----------

[](#plugmodule)

- Add Modules to Framework and run callback functions
- string $identifier
- callable $object
- string $callback
- returns void

```
public function plugModule($identifier, $object, $callback = null)

```

- Remove plugged in modules from Framework and run callback function
- string $identifier
- callback $callback
- returns void

```
public function unplugModule($identifier, $callback = null)

```

getModule
---------

[](#getmodule)

- Access the plugged in module
- string $module\_name
- returns callable

```
public function getModule($module_name)

```

get
---

[](#get)

- Get value from array using dot notation
- array $array
- string $key
- string $default
- returns void

```
public static function get($array, $key, $default = null)

```

set
---

[](#set)

- Set value of array using dot notation
- array $array
- string $key
- string $value
- returns void

```
public static function set(&$array, $key, $value)

```

getConfig
---------

[](#getconfig)

- Get configurations from config using dot notation
- string $key
- returns void

```
public static function getConfig($key)

```

setConfig
---------

[](#setconfig)

- Set value of config using dot notation
- string $key
- string $value
- returns void

```
public static function setConfig($key, $value)

```

getConfigRaw
------------

[](#getconfigraw)

- Get configurations from config using array key
- string $key
- returns void

```
public static function getConfigRaw($key)

```

setConfigRaw
------------

[](#setconfigraw)

- Set configurations in config using array key
- array key $key
- string $val
- returns void

```
public static function setConfigRaw($key, $val)

```

getConfigAll
------------

[](#getconfigall)

- Return config array for debugging purposes.
- returns void

```
public static function getConfigAll()

```

---

License
-------

[](#license)

LightFramework is released under permissive licese with following conditions:

- It cannot be used to create adult apps.
- It cannot be used to create gambling apps.
- It cannot be used to create apps having hate speech.
- You must mention LightFramework in credits.

### MIT License

[](#mit-license)

Copyright 2022 Nabeel Ali | IconicCodes.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

1471d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14184842?v=4)[Nabeel Ali](/maintainers/nabeelalihashmi)[@nabeelalihashmi](https://github.com/nabeelalihashmi)

---

Top Contributors

[![nabeelalihashmi](https://avatars.githubusercontent.com/u/14184842?v=4)](https://github.com/nabeelalihashmi "nabeelalihashmi (7 commits)")

---

Tags

phpphp-framework

### Embed Badge

![Health badge](/badges/nabeelalihashmi-lightframework/health.svg)

```
[![Health](https://phpackages.com/badges/nabeelalihashmi-lightframework/health.svg)](https://phpackages.com/packages/nabeelalihashmi-lightframework)
```

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M299](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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