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 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 yourcomposer.lock. - The
.envfile is generated from the project's environment variables. Do not commit a.env.APP_KEY(Laravel) andAPP_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.jsonhas abuildscript. - 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
- Open cPanel > Hodifly and connect your GitHub or GitLab repository.
- Pick the branch and the domain (or subfolder) to deploy.
- Leave the build command empty: Composer and assets are handled automatically.
- 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?.
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 or go to the Terminal in cPanel
- Check that you're in the root of your hosting:
cd ~
- Rename the
public_htmldirectory with the following command:
mv public_html public_html_bak
- Create a symlink between your
publicdirectory andpublic_htmlwith the following command (adjust/home/monuser/monappli/publicto 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, for example to use PHP 8.2 withcomposer:
ea-php82 /usr/local/bin/composer install
You can also create an alias in your shell 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 will do this for you. Just let us know the path to your public directory.
Updated on: 15/08/2026
Thank you!