Laravel Laravel
  • Prologue

    • Release Notes
  • Getting Started

    • Installation
    • Configuration
    • Docker
    • Update
    • Upgrade from v3
  • Advanced Topics

    • Settings
    • Keyboard Shortcuts
    • Advanced Setups
    • Honeypot and Teapots
    • External tracking with Matomo,
      Google Analytics & Co
  • Frequently Asked Question

    • General
    • Installation, migration, upgrade, update
    • Troubleshooting
  • Contributing

    • Contribution Guide
    • API Documentation
    • Lychee logic overview
    • Directory Structure
    • Front-end
  • Laravel

Directory Structure

  • The Root Directory
    • The App Directory
    • The Bootstrap Directory
    • The Config Directory
    • The Lang Directory
    • The Database Directory
    • The Public Directory
    • The Resources Directory
    • The Routes Directory
    • The Storage Directory
    • The Tests Directory
    • The vendor Directory
  • The App Directory
    • The Console Directory
    • The ControllerFunctions Directory
    • The Exceptions Directory
    • The Http Directory
    • The Image Directory
    • The Metadata Directory
    • The ModelFunctions Directory
    • The Policies Directory
    • The Providers Directory
    • The Relation Directory
    • The Redirection Directory
    • The Rules Directory

The Root Directory

The App Directory

The app directory contains the core code of your application. We'll explore this directory in more detail soon; however, almost all of the classes in your application will be in this directory.

The Bootstrap Directory

The bootstrap directory contains the app.php file which bootstraps Lychee. This directory also houses a cache directory which contains framework generated files for performance optimization such as the route and services cache files.

The Config Directory

The config directory, as the name implies, contains all of Lychee's configuration files. It's a great idea to read through all of these files and familiarize yourself with all of the options available to you.

The Lang Directory

The lang directory contains your language localization. If you wish, you can update our translations and submit a pull request.

The Database Directory

The database directory contains your database migrations, model factories, and seeds. If you wish, you may also use this directory to hold an SQLite database.

The Public Directory

The public directory contains the index.php file, which is the entry point for all requests entering Lychee and configures autoloading. This directory also houses your assets such as images, JavaScript, and CSS.

The Resources Directory

The resources directory contains your views as well as the TypeScript and CSS for the front-end.

The Routes Directory

The routes directory contains all of the route definitions for Lychee. Several route files are included with Lychee: api-v1.php, api-v2.php, web-admin-v1.php, web-admin-v2.php, web-install.php, web-v1.php, and web-v2.php.

This makes the separation between the two REST API: - v1 routes are used by legacy endpoints, i.e. version 4 of Lychee. This is mostly used as POST requests. - v2 routes are used by the Version 6 front-end with VueJs. It makes use of a more proper REST definition with PATCH, POST, GET and DELETE.

By default v1 routes are disabled since version 6.

The Storage Directory

The storage directory contains your compiled Blade templates, file based sessions, file caches, and other files generated by the framework. This directory is segregated into app, framework, and logs directories. The app directory may be used to store any files generated by your application. The framework directory is used to store framework generated files and caches. Finally, the logs directory contains Laravel's log files (useful in case of hard crash).

The Tests Directory

The tests directory contains your automated tests. An example PHPUnit test is provided out of the box. Each test class should be suffixed with the word Test. You may run your tests using the commands: make test, phpunit or php vendor/bin/phpunit commands.

{note} This directory is not provided in the release zip file in order to reduce the size of the archive.

The vendor Directory

The vendor directory contains your Composer dependencies.

{tip} While this directory is not provided if you use git to manage your Lychee installation, we provide it in the release wip file.

The App Directory

The majority of Lychee is housed in the app directory. By default, this directory is namespaced under App and is autoloaded by Composer using the PSR-4 autoloading standard.

The app directory contains a variety of additional directories such as Console, Http, and Providers. Think of the Console and Http directories as providing an API into the core of your application. The HTTP protocol and CLI are both mechanisms to interact with Lychee, but do not actually contain application logic. In other words, they are two ways of issuing commands to Lychee. The Console directory contains all of the Artisan commands, while the Http directory contains your controllers, middleware, and requests.

The Console Directory

The Console directory contains all of the custom Artisan commands for Lychee. These commands may be generated using the make:command command.

The ControllerFunctions Directory

The ControllerFunctions directory houses some of the Logic of Lychee. It currently is dedicated to the Installation and Update process. It should hold more logic in the future.

The Exceptions Directory

The Exceptions directory contains Lychee's exception handler. If you would like to customize how your exceptions are logged or rendered, you should modify the Handler class in this directory.

The Http Directory

The Http directory contains your controllers, middleware, and form requests. Almost all of the logic to handle requests entering your application will be placed in this directory.

It currently houses some logic which should be refactored away.

The Image Directory

The Image directory contains our image handler. We provide here two ways to manipulate pictures:

  • with GD,
  • with imagick.

The Metadata Directory

The Metatdata directory contains logic related to data such as Exif information, geodecoding, lychee version, GitHub monitoring...

The ModelFunctions Directory

The ModelFunctions directory contains logic related to the models. This aims to improve interaction between models without clustering their files with logic.

The Policies Directory

The Policies directory contains the authorization policy classes for your application. Policies are used to determine if a user can perform a given action against a resource.

The Providers Directory

The Providers directory contains all of the service providers for Lychee. Service providers bootstrap Lychee by binding services in the service container, registering events, or performing any other tasks to prepare your application for incoming requests.

The Relation Directory

The Relation directory contains the handcrafted relationships used by Lychee between models. Those house some of the most complex part of Lychee.

The Redirection Directory

The Redirection directory houses main redirection to handle the installation (database not set) and safety cases (security key not set).

The Rules Directory

The Rules directory contains the custom validation rule objects for your application. Rules are used to encapsulate complicated validation logic in a simple object.

{tip} Caught a mistake or want to contribute to the documentation? Edit this page on Github!