PHPackages                             lfphp/plite - 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. lfphp/plite

ActiveLibrary[Framework](/categories/framework)

lfphp/plite
===========

php lite web framework

2.0.24(3mo ago)01891PHPCI failing

Since May 31Pushed 2w ago1 watchersCompare

[ Source](https://github.com/sasumi/PLite)[ Packagist](https://packagist.org/packages/lfphp/plite)[ RSS](/packages/lfphp-plite/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (86)Used By (1)

PLite lightweight functional framework
======================================

[](#plite-lightweight-functional-framework)

lightweight, high-performance PHP development framework is implemented using functional methods . The framework integrates routing, controllers, configuration, static resource version control, reference event monitoring and triggering, and other capabilities to quickly implement a simple and lightweight web system. The framework uses namespace + constant prefix to protect the runtime from polluting other code bases and ensure code compatibility.

1. Installation
---------------

[](#1-installation)

### 1.1 Manual Installation

[](#11-manual-installation)

Please clone the plité repository via git to download the latest version of the framework code:

```
git clone https://github.com/sasumi/PLite.git
```

Copy the code to the project code directory and import the startup file:

```
include_once "autoload.php";
```

### 1.2 Installation via `composer`

[](#12-installation-via-composer)

Framework environment dependencies: a. PHP version ≥ 7.1 b. php ext-json extension c. lfphp/func function (automatically installed)

Install using Composer:

```
composer require lfphp/plite
```

### 1.3 Installation via `lfphp/pls`

[](#13-installation-via-lfphppls)

`lfphp/pls` is the plité installation script. The script includes multiple functions such as plité installation, project initialization, ORM generation, CRUD code generation, etc. It is recommended to use it.

Installation pls:

```
composer require lfphp/pls
```

2. Basic usage
--------------

[](#2-basic-usage)

For basic usage of the framework, please refer to the code examples in the `test/DemoProject` directory.

### 2.1 Configuration File

[](#21-configuration-file)

**Global Control Variables**

Except for `PLITE_APP_ROOT`, which needs to be manually configured in the project, other `PLITE_*` constants have default values. The following lists only some important constants. If you need to know all constant definitions, you can refer to the framework code file: `src/defines.php`.

Variable NameDescriptionDefault Value`PLITE_APP_ROOT`The project running root directory, other configuration file path logic is generally based on this directory extension.Required`PLITE_SITE_ROOT`Site access URL path, such as: , of course, can be simplified to `/` absolute configuration.`/``PLITE_CONFIG_PATH`Configuration file directory, provided for use by the `get_config()` function. To distinguish it from other PHP files, it is generally named in the file.inc.php format. The configuration file uses the return syntax to return the configuration value.`PLITE_APP_ROOT.'/config'``PLITE_PAGE_PATH`Template page directory, used by the `include_page()` function.`PLITE_APP_ROOT.'/src/page'``PLITE_PAGE_NO_FOUND`404 page template`404.php` (placed under `PLITE_PAGE_PATH`)`PLITE_PAGE_ERROR`500 Site Error Page`5xx.php` (placed under `PLITE_PAGE_PATH`)**Program Configuration**

The framework's default configuration file directory is: `PLITE_APP_ROOT + '/config'`, which can be reset by `CONFIG_PATH`. The configuration file in this directory is named in the format of `config_key.inc.php`. The data returned by the configuration file can be obtained through the function `get_config('config_key')`, or the internal array sub-items can be directly obtained through the `get_config('parent/child')` method. Example:

```
//The content of the configuration file site.inc.php is:
