Installation

Lean is a composer package that can be installed in multiple ways: zip files, the GitHub repository, and our private composer repository.

We recommend using the private composer repository, because you won't have to change your composer.json repositories for production deploys.

That option also comes with an automatic installer.

Requirements

Lean requires Laravel 8 and PHP 7.4.

PHP 8 was released a few months ago and it's close to having full support by the most popular tools and extensions. Which means that in the near future, Lean might switch to PHP 8 as well.

Since Lean is an admin panel built using very new technology (Livewire, Tailwind CSS, Alpine.js), this shouldn't be an issue to our users.

In general, we like to keep things as modern as possible and have a "release early, release often" approach to major releases. Meaning, we won't wait an arbitrary number of months to accumulate big changes and release the next major version. By releasing major versions often, new features will be out earlier, and upgrading between versions will be much easier.

Automatic installer

To install Lean using the private composer package — the recommended approach — you can use our automatic installer.

Simply require the installer with composer:

composer require leanadmin/installer

And run the lean:setup command:

php artisan lean:setup

This will run the installation wizard which does everything for you — sets up an API token, adds it to auth.json, adds a composer repository, and installs the actual package.

Lean Admin Installer
--------------------

First, we'll need your login information for lean-admin.dev.
This won't be stored anywhere and will only be used to generate an API token.

 What's your email? [[email protected]]:
 > [email protected]

 What's your password?:
 >

Successfully logged in.

Now we need to generate an access token for composer.

 Token name [Laravel @ MacBook-Pro.local]:
 > Laravel @ MacBook-Pro.local

Generating token...
Token successfully added to auth.json.
Repository added to composer.json.
Requiring leanadmin/lean...
leanadmin/lean required.
Running the install command...
Provider published and registered.
Frontend assets published.
Translation files published.
User Resource published.
Welcome Page published.
Config file published.
Added Lean routes.
✨ Lean is fully installed.
Install command succeeded.

----------------------

✅ Everything succeeded ✅

🚀 Lean is now installed and accessible on http://installer-test.test/admin.

If the /admin route is already occupied, you may need to make small changes.
Please see your routes/web.php file to verify that the routes were added correctly.

----------------------

You can remove the installer dependency by running `composer remove leanadmin/installer`.

 Remove installer now? (yes/no) [yes]:
 > yes

Installer dependency removed.

If you use the automatic installer, you don't need to follow the rest of this page. Everything has been taken care of for you.

Manual installation

In some cases, the automatic installer might not work for you, or you may want a little more control. For that, we have documented manual installation too.

First, to pull in Lean, you need to tell composer where to find it.

GitHub repository

Will work locally and supports dev version constraints (e.g. dev-master). Not recommended in production.

Configure a composer repository:

composer config repositories.lean vcs [email protected]:LeanAdmin/lean.git

When you install the package, it will ask you for authentication details. Usually you'll want to use a Personal Access Token.

Private composer repository

Recommended, works both locally and in production. Only supports tagged versions.

Configure a composer repository:

composer config repositories.lean composer https://lean-admin.dev/releases

And create an auth.json file at the root of your project. It should look like this:

{
    "bearer": {
        "lean-admin.dev": "your-api-token"
    }
}

You can generate an API token on your API tokens page.

Production considerations

It's a good idea to use one API token per deploy environment — with each token having a name that tells you what environment it's being used in.

Creating an auth.json file can be painful in some environments (however most apps can use it just fine). A good alternative is using a global auth.json file on the server or the COMPOSER_AUTH environment variable.

You can locate the global composer config directory using this command:

composer config --list --global | grep home

It will show a directory. cd into it and create an auth.json file if it doesn't exist yet. If it does exist, add the key to the bearer section.

If you want to use the COMPOSER_AUTH environment variable, set it to the above JSON snippet (formatted into a single line).

Installing the package

Note: This is only needed if you installed Lean manually. If you used the automatic installer, this is already done.

After you've configured the repository, you can install the package via composer:

composer require leanadmin/lean

After that, run:

php artisan lean:install

This will publish:

  • a service provider and register it in your config/app.php file
  • the localization file
  • the WelcomePage
  • the UserResource

It will also add a Lean::routes() call to your routes/web.php file. Please check that it's in the right place — and if not, move it to the right route group.

If this all went well, you can start using Lean. Visit /admin on your app and you should be presented with a Welcome screen.

Now, it's time to create your own Resources.