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:

  • views/: Directory for storing template files used by the view engine.
  • App.php: Main file where the application is configured and initialized.
  • models/: Models that represent the data structure of the application.
  • database/: Contains database migrations and related configurations.
  • http/: Functionalities related to the HTTP layer of the application.
    • controllers/: Controllers that respond to HTTP requests and interact with the models.
    • middlewares/: Middleware functions that intercept and manipulate HTTP requests.
  • 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.