Lithe Installation

Learn how to install Lithe in your development environment using Composer.

Prerequisites

Before starting, make sure you have Composer installed on your machine. If you don’t have it, you can download and install it from the official Composer site.


Installation via Composer

To create a new Lithe project, run the following command in the terminal:

composer create-project lithephp/lithephp example-app

This will create a new directory called example-app and install Lithe along with all necessary dependencies.


Environment Setup

After installation, navigate to the project directory:

cd example-app

Web Server Configuration

To run your Lithe application, you can use PHP's built-in web server. Start the server with the following command:

php line serve

Now, your application will be accessible at http://localhost:8000.


Project Structure

The Lithe project generated by Composer will follow an organized structure that facilitates application development and maintenance. Here is an overview of the typical directory structure:

  • src/: Contains all the components of the application.

    • views/: Stores the template files used by the view engine.
    • App.php: Main file where the application is configured and initialized.
    • models/: Contains the models that represent the application's data structure.
    • http/: Functionality related to the application's HTTP layer.
      • controllers/: Controllers that handle HTTP requests and interact with the models.
      • middleware/: Middleware functions that intercept and manipulate HTTP requests.
    • database/: Includes database migrations and related configurations.
  • public/: Entry point for the web server.

    • index.php: Initial file that directs all HTTP requests to the application.

This structure clearly separates the responsibilities of the application, making it easier to organize and expand the project as it grows. Each directory has a specific purpose, ensuring a clean and modular architecture for efficient development.


Next Steps

After installation, you can start developing your application using Lithe. Explore the documentation to learn more about routing, middleware, controllers, database usage, and much more.