PHPackages                             juneszh/alight - 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. juneszh/alight

ActiveLibrary[Framework](/categories/framework)

juneszh/alight
==============

Alight is a light-weight PHP framework. Easily and quickly build high performance RESTful web applications.

v2.1.4(5mo ago)89381↓33.3%62MITPHPPHP &gt;=7.4

Since Aug 10Pushed 2mo ago9 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (17)Used By (2)

Alight
======

[](#alight)

Alight is a light-weight PHP framework. Easily and quickly build high performance RESTful web applications. Out-of-the-box built-in routing, database, caching, error handling, logging and job scheduling libraries. Focus on creating solutions for the core process of web applications. Keep simple and extensible.

Alight Family
-------------

[](#alight-family)

ProjectDescription[Alight](https://github.com/juneszh/alight)Basic framework built-in routing, database, caching, etc.[Alight-Admin](https://github.com/juneszh/alight-admin)A full admin panel extension based on Alight. No front-end coding required.[Alight-Project](https://github.com/juneszh/alight-project)A template for beginner to easily create web applications by Alight/Alight-Admin.Requirements
------------

[](#requirements)

PHP 7.4+

Getting Started
---------------

[](#getting-started)

- [Installation](#installation)
- [Configuration](#configuration)
- [Routing](#routing)
- [Database](#database)
- [Caching](#caching)
- [Error Handling](#error-handling)
- [Job Scheduling](#job-scheduling)
- [Helpers](#helpers)

Installation
------------

[](#installation)

### Step 1: Install Composer

[](#step-1-install-composer)

Don’t have Composer? [Install Composer](https://getcomposer.org/download/) first.

### Step 2: Creating Project

[](#step-2-creating-project)

#### Using template with create-project

[](#using-template-with-create-project)

```
$ composer create-project juneszh/alight-project {PROJECT_DIRECTORY}
```

The project template contains common folder structure, suitable for MVC pattern, please refer to: [Alight-Project](https://github.com/juneszh/alight-project).

*It is easy to customize folders by modifying the configuration. But the following tutorials are based on the template configuration.*

### Step 3: Configuring a Web Server

[](#step-3-configuring-a-web-server)

Nginx example (Nginx 1.17.10, PHP 7.4.3, Ubuntu 20.04.3):

```
server {
    listen 80;
    listen [::]:80;

    root /var/www/{PROJECT_DIRECTORY}/public;

    index index.php;

    server_name {YOUR_DOMAIN};

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}
```

Configuration
-------------

[](#configuration)

All of the configuration options for the Alight framework will be imported from the file 'config/app.php', which you need to create yourself. For example:

File: config/app.php

```
