Download the PHP package arefshojaei/lite-php without Composer
On this page you can find all versions of the php package arefshojaei/lite-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arefshojaei/lite-php
More information about arefshojaei/lite-php
Files in arefshojaei/lite-php
Informations about the package lite-php
Tutorial :
- Introduction
- What is Lite-PHP ?
- Why Lite-PHP ?
- Installation
- Flow chart of process
- Folder Structure
- core/
- bootstrap/
- public/
- modules/
- plugins/
- console/
- resources/
- hooks/
- storage/
- Root Files
- .env.example
- .gitignore
- .htaccess
- cli
- composer.json
- gulpfile.mjs
- init
- package.json
- README.md
- robots.txt
- server.php
- Modules
- alias
- config
- enum
- plugin
- validator
- Template Engine
- Cli ( console )
- Helpers
- import
- route
- dd
- parse
- view
- command
- test
- abort
- build
- translate
- url
- assets
- validator
- assert
- Hooks
- useHTTP
- useGET
- usePOST
- useFetch
- useID
- useConfig
- useEnum
- useState
- useGlobal
- useHash
- usePasswordVerfiy
- useHTML
- useMode
- useEnv
- useLog
- useError
- usePlugin
- useQuery
- useResponse
- useRequest
- useRedirect
- useURL
- useBody
- useHeader
- useMatch
- useFlash
- useFile
- useUpload
- useCache
- useCookie
- useSession
- useToken
- useVerifyToken
- useValidator
- useAction
- useTable
- useRecord
Introduction
What is Lite-PHP ?
Lite-PHP is a Micro Freamework for developing Back-end applications
Why Lite-PHP ?
Because Lite-PHP has:
Simple & Fast Development Env
Modular Strucutre
DBMS Like Mysql
Testing Module
Custom Plugins & Hooks
Custom Command-line in console
REST API Development
Functional Programming Structure
Folder Strucutre
No OOP & No Object & No Class
Installation
Using Composer
Using GIT
View of LITE PHP process in application
Folder Structure
Here is default folder structure for starting new project !
core/
Main files or Lite-PHP core files that can be provided base files for every projects!
bootstrap/
Base files to boot the app
modules/
Modules that the app needs to run as main file
hooks/
Lets you to development custom hooks
plugins/
Lets you to development custom plugin
public/
Static files in production with entry point file ( index.php )
resources/
Asset and View files
storage/
Local folder & files like Log, Cache & Upload ...
Root Files
.env.example
This is a config for ENV , Then before starting the project you must changed it from .env.example to .env file!
.gitignore
This is a config to hide files to not push on Github
.htaccess
Apache web server config
cli
Console configuration to use commands
composer.json
Passport of package info
gulpfile.mjs
Task-runner configuration for assets
init
Basic setup configuration to development app
package.json
List of pacakge dependencies that the Task-runner needs to run
README.md
Lite-PHP Package info
robots.txt
This is configuration for crawlers of Google
server.php
Main file for launching the app
Modules
Alias
Registers custom Alias
1-Example:
2-How can I use that ?
Move to "bootstrap/alias.php" Then, register an Alias by this way :
Config
Registers new configuration for a module
1-How can I create a config ?
2-How can I use the config ?
Enum
Registers an Enum as constant
1-How can I create an Enum ?
2-How can I use the Enum ?
Plugin
Registers new Plugin
Note: We have two types for using plugin :
Runner Type needs to register in "bootstrap/providers.php"
- Usage Type needs to use in function or logic code
1-How can I create a Runner type Plugin ?
2-How can I use the Runner Plugin ?
Move to "bootstrap/providers.php" , then use this way to register the Runner Plugin
3-How can I create a Usage type Plugin ?
4-How can I use the Usage Plugin ?
Note: for using the plugin, you should use this way
Validator
Defines Schema for input data
1-How can I create a Schema ?
2-How can I use that ?
Cli
These are list of commands that can be done works to develop your application!
Template Engine
Provides to work as professional with templates instead of using usual php template engine !
Examples :
Before - views/user.php
After - views/user.hbs
NOTE: We want to work it as professional with customized .hbs template engine and we don't have this like JS lib ( handlebars ) template engine and you should know about it that we have a customized template engine !
Syntaxes
Directives
Condition
Loop
Partial
Script
Validation
Auth
Helpers
import
Loads file by Alias
Route
Adds new Route in a module
Note: You can use it by two ways:
Add Single Route
- Group Routes
DD
Dumps and dies an Array in browser
Note : You don't need to load the helper, Because the helper has loaded !
Parse
Gets file content
View
Renders view template
Command
Adds new Command to use in console
Note: You can use it by two ways:
Add Single Command
- Group Commands
Test
Tests module
Note: You can test by two ways:
Test single module by name
- Test all modules
Abort
Throw HTTP error as Rendered page to show Error message
Build
Builds new path & URL
Translate
Translates content
URL
Provides to use helper functions for URL, Route and ...
Assets
Provides to use helper functions for Asset files
Validator
Provides to validate data
Assert
Provides to assert data in unit test
-
Note: You must use it when you are writing tests that exists in every modules of app with _test.php file!
- If you like to use more asserts, you should move to "core/helpers/assert.php" file
Hooks
Note: You should use hooks in logic code and don't use that outer of logic code!
UseHTTP
Provides to use http as $_SERVER super global
UseGET
Provides to use $_GET super global
UsePOST
Provides to use $_POST super global
UseFetch
Provides to send http request
Examples :
UseID
Provides to get random number ID
UseConfig
Provides to get Config by key
Note: Sometimes you don't want to get error for getting value from the hook usage, First you should load target module configuration in current file or script !
UseEnum
Provides to get Enum by key
Note: sometimes you dont' want to get error for getting value from the hook usage, First you should load target module configuration in current file or script !
UseState
Provides to define state in container as $GLOBALS['container'] super global
Note: The hook has more option that you will like that
Define state as "value"
Define state as "key" & "value"
- Define state as "key" (Nested) & "value"
UseGlobal
Provides to get value from container as $GLOBALS['container'] super global
UseHash
Provides to hash password
UseVerifyPassword
Provides to verify hashed password
UseHTML
Provides to get html content by url
UseMode
Provides to get current app mode from ".env" as APP_MODE ( Production | Development )
UseEnv
Provides to get env from ".env" by key
UseLog
Provides to put log message
UsePlugin
Provides to use plugins that has usage type
UseQuery
Provides to run SQL query
UseResponse
Provides to return content output to the response as JSON | HTML | TEXT
Note : You don't need to set content-type in header, Because the hook has done it
- @Reference : core/hooks/useType
- @Reference : core/hooks/useResponse
UseRequest
Provides the request data
UseRedirect
Provides to redirect to a route
UseURL
Provides to parse URL
UseBody
Provides to get the request body data
UseHeader
Provides to add & remove header by key and value
UseMatch
Provides to use regex
UseFlash
Provides to add & remove falsh message
useFile
Provides to get file from $_FILES
useUpload
Provides to upload file in local stroage
useCache
Provides to cache data
useCookie
Provides to use cookie in process of app
useSession
Provides to use session in process of app
UseToken
Provides to generate new token
UseVerifyToken
Provides to verify token
useValidator
Provides to validate input data
useAction
Provides to save action in local database
useRecord
Provides to save data in local database
useTable
Provides to get & delete data in local database