Download the PHP package awaisjameel/laravel-cpanel-hosting without Composer

On this page you can find all versions of the php package awaisjameel/laravel-cpanel-hosting. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cpanel-hosting

Laravel cPanel Hosting

A robust, secure, and production-ready Laravel package that makes deploying Laravel applications on cPanel / shared hosting painless and professional.

Shared hosting doesn't give you SSH-driven CI/CD, so this package exposes a small set of authenticated HTTP endpoints that let a webhook (GitHub, GitLab, Bitbucket, or your own script) drive a deployment: pull the latest code (outside the scope of this package), then hit /deploy to sync the environment, run migrations, rebuild caches, relink storage, and flip maintenance mode — all guarded by a token, an IP allowlist, and optional rate limiting.

Features

Requirements

Installation

Run the installer:

This will:

  1. Publish config/cpanel-hosting.php.
  2. Install index.php and .htaccess at your project root (backing up any existing files first), so the app root can be pointed at your Laravel project directory directly instead of public/ on cPanel.
  3. Append the package's env keys to .env.example if they're missing.
  4. When run interactively, prompt you to generate/set a deploy token, choose a route prefix, and optionally enable deploy routes immediately — writing the answers straight into .env.

Installer options:

Option Effect
--force Overwrite existing root index.php / .htaccess / config instead of skipping them.
--only-config Publish only the config file, skip the root stubs.
--only-root Install only the root stubs, skip publishing config.

Non-interactively (e.g. in CI or a deploy script), the command skips the .env prompts and just publishes files:

Configuration

Publish the config manually if you skipped it during install:

Every option reads from an environment variable so config/cpanel-hosting.php rarely needs to be touched directly:

Key Default Notes
enabled false Deploy routes only register when this is true. Keep it false until you're ready.
token null Shared secret compared with hash_equals(). Required unless you're using webhook signatures instead.
webhook_secret null Enables X-Hub-Signature-256 (GitHub, HMAC-SHA256 over the raw body) and X-Gitlab-Token (direct compare) auth.
route_prefix deploy Prefix all deploy routes live under.
allowed_ips null Comma-separated string or array of IPs; when set, only listed IPs may reach deploy routes (checked before auth).
rate_limit.* disabled A lightweight in-memory (per-request-lifetime) limiter — see Security Notes for why this isn't a substitute for a real throttle.
sync_env.source / target .env.server / .env Paths are resolved relative to the app base path unless absolute.
sync_env.backup true Writes {target}.backup.{YmdHis} before overwriting.
sync_env.required_keys ['APP_KEY'] Sync fails if any of these keys are absent from the synced file. Edit the published config to add more (e.g. DB_PASSWORD).
storage_link.prefer_symlink true Try symlink() first.
storage_link.fallback_copy true If symlink() is unavailable or fails, recursively copy instead (with 0755/0644 permissions applied).
storage_link.source / public_path app/public / storage Resolved via storage_path() / public_path() unless absolute.
mysql_legacy_compat.enabled true Calls Schema::defaultStringLength() on boot when the active connection driver is mysql/mariadb.
mysql_legacy_compat.all_connections false When true, checks all configured connections instead of just database.default.
pipeline.default_steps see below The ordered list of steps GET /deploy runs.
pipeline.stop_on_failure true Stop the pipeline at the first failed step, or run all steps and report an overall failure.
maintenance.secret null Passed as --secret to php artisan down, letting you bypass the maintenance page via /?secret=....
logging.channel deploy Auto-registered as a single driver writing to storage/logs/cpanel-deploy.log if you haven't defined this channel yourself.

Endpoints

Once CPANEL_DEPLOY_ENABLED=true, routes are registered under CPANEL_DEPLOY_PREFIX (default deploy):

Method & Path Purpose
GET /deploy Runs the full pipeline (pipeline.default_steps).
GET /deploy/sync-env Copies sync_env.source over sync_env.target.
GET /deploy/clear optimize:clear.
GET /deploy/migrate migrate --force.
GET /deploy/migrate-fresh migrate:fresh --forcedestructive, drops all tables.
GET /deploy/cache config:cache, route:cache, view:cache, event:cache.
GET /deploy/queue-restart queue:restart.
GET /deploy/storage-link Symlink (or copy-fallback) storage/app/public into public/storage.
GET /deploy/maintenance-down down --retry=60, plus --secret if maintenance.secret is set.
GET /deploy/maintenance-up up.
GET /deploy/optimize optimize.
GET /deploy/health Unauthenticated-payload health check (still requires deploy auth) — returns app_env, timestamp, and route prefix.

Every endpoint returns a consistent JSON shape:

Deploy routes deliberately bypass the session, CSRF, and default throttle middleware (see routes/deploy.php) since requests come from webhooks/CLI, not a browser session — auth is entirely handled by EnsureDeployTokenIsValid.

Authentication

Checked in this order by the deploy middleware:

  1. IP allowlist (CPANEL_DEPLOY_ALLOWED_IPS) — if set, non-matching IPs get a 403 before auth is even checked.
  2. Rate limit (if enabled) — exceeding it returns 429.
  3. Webhook signatureX-Hub-Signature-256: sha256=... (HMAC-SHA256 of the raw request body, GitHub-style) or X-Gitlab-Token: <secret>, compared with hash_equals().
  4. Deploy tokenX-Deploy-Token: {token} header (preferred) or ?token={token} query string, compared with hash_equals().

If none of these pass, the route returns 403. If CPANEL_DEPLOY_ENABLED is false, every deploy route returns 404 rather than 403, so an unconfigured install doesn't leak the fact that the routes exist.

Customizing the pipeline

pipeline.default_steps accepts a mix of:

Events

Listen for these to wire up notifications or auditing:

Facade

Root hosting layout (cPanel public_html)

cPanel-style shared hosting typically serves everything under public_html/ directly, but Laravel expects the web root to be public/. The installer's root stubs solve this without a symlink:

Deploy your Laravel project as-is to public_html/ (or a subdirectory pointed at by your domain), run the installer once, and the app is servable without moving files around or fighting cPanel's document root.

Security Notes

Testing

Runs the Pest suite under tests/ (feature tests for deploy routes/middleware, unit tests for SyncEnvAction and StorageLinkAction) via Orchestra Testbench. Also available:

Changelog

See CHANGELOG.md for recent changes.

Contributing

Issues and pull requests are welcome at github.com/awaisjameel/laravel-cpanel-hosting.

License

The MIT License (MIT). See LICENSE for more information.


All versions of laravel-cpanel-hosting with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package awaisjameel/laravel-cpanel-hosting contains the following files

Loading the files please wait ...