Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon What are the steps to install Twill on an existing Laravel application
    Twill installation Laravel Twill setup Twill guide Laravel CMS Twill configuration Twill admin console Twill module creation


What are the steps to install Twill on an existing Laravel application


To install Twill on an existing Laravel application, follow these steps:

1. Install Twill using Composer: In your Laravel project's root directory, run the following command to install the latest version of Twill:


   composer require area17/twill:"^3.0"
   

This will add the Twill package to your project's dependencies.

2. Publish Twill's Configuration and Assets: Run the following Artisan commands to publish Twill's configuration files and assets:


   php artisan twill:install
   

This command will:
- Create a `twill.php` configuration file in your `config` directory.
- Create a `twill.php` routes file in your `routes` directory.
- Publish Twill's assets to your `public` directory.

3. Set up the Database: Twill requires a database connection to store its data. Make sure your `.env` file is configured with the correct database credentials, and then run the following command to migrate the Twill-specific database tables:


   php artisan migrate
   

4. Configure Twill's Admin Console: By default, Twill's admin console is available at the `/admin` path of your application. If you want to modify this path, you can use the `ADMIN_APP_PATH` environment variable. For example, to set the admin console to `/cms`, add the following line to your `.env` file:


   ADMIN_APP_PATH=/cms
   

Alternatively, if you want to serve Twill from a subdomain, you can set the `ADMIN_APP_URL` environment variable:


   ADMIN_APP_URL=https://admin.domain.test
   

Make sure the `admin` subdomain is available and pointing to your app's `public` directory.

5. Create Your First Twill Module: Twill provides a command to quickly scaffold a new module. Run the following command to create a basic "Snippets" module:


   php artisan twill:module snippets
   

This will create the necessary files and database migrations for your new module.

6. Customize and Extend Twill: Twill is designed to be highly customizable. You can modify the admin UI, create custom data models, and integrate Twill with your existing application. Refer to the Twill documentation for more information on how to extend and customize Twill to fit your needs.

That's it! You have now successfully installed Twill on your existing Laravel application. You can now start creating and managing content using Twill's admin console.

Citations:
[1] https://twillcms.com/docs/getting-started/installation.html
[2] https://github.com/area17/twill/releases
[3] https://www.vrdvishwas.com/twill-cms-install-setup/
[4] https://tech.codivores.com/ltivt-4-laravel-twill-basics
[5] https://github.com/area17/twill-api