Download the PHP package nabeelalihashmi/lightframework without Composer
On this page you can find all versions of the php package nabeelalihashmi/lightframework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nabeelalihashmi/lightframework
More information about nabeelalihashmi/lightframework
Files in nabeelalihashmi/lightframework
Package lightframework
Short Description Module PHP Framework Base
License MIT
Informations about the package lightframework
LightFramework
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
Nabeel Ali | https://iconiccodes.com | [email protected]
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
* Easy
* Very minimum code for initialization.
* Deferred calls
* Call deffered calls prematurely when required.
* Add callables as plugin
Installtion
Install via Composer
Or Download the class and use own autoloading function.
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:
- 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 plugincallback
: the callback called by framework when object is loaded.
Example:
- Initiate the Framework
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
getVersion
-
Get version of the LightFramework
- Constructor
- string $config_dir
- string $autoload_dir
- string $global_symbol
instance
- Returns the instance of framework if constructor is called otherwise thrrows exception
- returns self
- @throws Exception
defer
- Defer the call to run at the end of exection or when runDefered() is called
- integer $id
- callable $callback
- returns void
init
- Initiate the function
- returns void
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
plugModule
- Add Modules to Framework and run callback functions
- string $identifier
- callable $object
- string $callback
-
returns void
- Remove plugged in modules from Framework and run callback function
- string $identifier
- callback $callback
- returns void
getModule
- Access the plugged in module
- string $module_name
- returns callable
get
- Get value from array using dot notation
- array $array
- string $key
- string $default
- returns void
set
- Set value of array using dot notation
- array $array
- string $key
- string $value
- returns void
getConfig
- Get configurations from config using dot notation
- string $key
- returns void
setConfig
- Set value of config using dot notation
- string $key
- string $value
- returns void
getConfigRaw
- Get configurations from config using array key
- string $key
- returns void
setConfigRaw
- Set configurations in config using array key
- array key $key
- string $val
- returns void
getConfigAll
- Return config array for debugging purposes.
- returns void
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
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.