> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.hodi.host/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How do I deploy a Laravel or Symfony site?

Two methods, depending on whether you want to deploy from a Git repository or install the application by hand on your hosting.

## Recommended: deploy with Hodifly

[Hodifly](https://help.hodi.host/en/article/what-is-hodifly-1b7f6tw/) deploys your Laravel or Symfony application straight from GitHub or GitLab on every `git push`. There is no SSH, no symlink and no `composer install` to run: it all happens on the server, on every deploy.

Hodifly works **on every web hosting plan**, including the cheapest ones: a PHP application is served by the web server itself, so it does not need the "applications" feature that Node, Python and Ruby apps require.

### What Hodifly does for you

* **The document root** points automatically at the front-controller folder of the deployed release: `public/` for Laravel and Symfony. The rest of the application (`.env`, `vendor/`, `app/`, `config/`, `storage/`) is never reachable over HTTP. That is exactly the problem the manual method below solves with a symlink: here there is nothing to do.
* **Composer** runs on every deploy (`install --no-dev --prefer-dist --optimize-autoloader`). Commit your `composer.lock`.
* **The `.env` file** is generated from the project's environment variables. Do not commit a `.env`. `APP_KEY` (Laravel) and `APP_SECRET` (Symfony) are generated once and kept outside the releases, so sessions survive deploys.
* **Migrations** run before the new release goes live. A failed migration leaves the previous release serving: the site does not break.
* **Front-end assets** (Vite, Laravel Mix, Webpack Encore) are built automatically when your `package.json` has a `build` script.
* **Laravel's scheduled tasks** are wired into the account's crontab on their own.
* **Rolling back** is instant from cPanel, with no rebuild.

### Getting started

1. Open **cPanel > Hodifly** and connect your GitHub or GitLab repository.
2. Pick the branch and the domain (or subfolder) to deploy.
3. Leave the build command empty: Composer and assets are handled automatically.
4. Fill in your environment variables (database, API keys), then deploy.

The full details (runtimes, monorepos, queues, persistent data) are in [What can I deploy on Hodifly?](https://help.hodi.host/en/article/what-can-i-deploy-on-hodifly-czlbyz/).

||| 💡 Good to know: Hodifly also recognises Lumen, CodeIgniter 4, Yii 2, CakePHP and Slim, and points the document root at the right folder for each one (`public/`, `web/` or `webroot/`).

## Manual: install the application yourself

If you are not using Hodifly and you install the application by hand, the folder problem remains: your hosting serves `public_html`, while Laravel and Symfony require their `public` folder to be served.

There's a simple method for using Symfony or Laravel with your hosting:

* [Log in via SSH](https://help.hodi.host/en/article/how-do-i-access-my-hosting-via-ssh-143pq07/) or go to the **Terminal** in cPanel

* Check that you're in the root of your hosting:
cd ~
* Rename the `public_html` directory with the following command:
mv public_html public_html_bak
* Create a symlink between your `public` directory and `public_html` with the following command (adjust `/home/monuser/monappli/public` to match your setup):
ln -s /home/monuser/monappli/public public_html
* Finally, to run `composer`, you need to specify the PHP version to use [if you've changed your hosting's PHP version](https://help.hodi.host/en/article/how-do-i-change-my-hostings-php-version-7yxqqr/), for example to use PHP 8.2 with `composer`:
ea-php82 /usr/local/bin/composer install
You can also [create an alias in your shell](https://linuxize.com/post/how-to-create-bash-aliases/) if you'd like to call `composer` with just the composer command.
**Tip:** if you're on a plan where SSH access isn't included, our [technical support](https://hodi.host/submitticket.php?step=2&deptid=2) will do this for you. Just let us know the path to your `public` directory.