Using Composer
No SSH on free hosting, so run Composer locally and upload vendor/.
The short version
The free tier doesn’t include SSH or a shell, so you can’t run composer install on the server. The standard approach is to run Composer on your local machine and upload the resulting vendor/ directory along with your code.
Local workflow
- Install Composer locally from getcomposer.org.
- In your project folder run
composer install. This creates avendor/directory with the libraries you depend on and an autoloader. - Upload your project to the hosting panel’s File Manager, including the
vendor/directory. - Require the autoloader at the top of your PHP files:
require __DIR__ . '/vendor/autoload.php';
Speed up large uploads
The vendor/ tree can be thousands of small files. Two practical tricks:
- Zip and upload: compress
vendor/locally into a single archive, upload, then use the file manager’s Extract action. This avoids per-file overhead. - SFTP / FTP: use a client like FileZilla or Cyberduck. Set the concurrent transfer limit higher so the small files go up in parallel.
Lock the production build
Run this locally before zipping:
composer install --no-dev --optimize-autoloader
--no-devskips dev-only packages (PHPUnit, etc.).--optimize-autoloadergenerates a static class map so autoloads are faster than on-disk scanning.
Keep vendor out of the document root if you can
The conventional layout puts public_html alongside vendor/ rather than inside it:
your-app/
├── public_html/ ← document root
│ └── index.php (uses ../vendor/autoload.php)
├── src/
├── vendor/
└── composer.json
If your account forces everything under public_html/, add an .htaccess inside the vendor/ folder with:
Require all denied
Updating versions
Edit composer.json on your local machine, run composer update there, and re-upload the new vendor/. Always commit composer.lock alongside composer.json so your deployments are reproducible.