Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Cpanel Laravel Package

webreinvent/laravel-cpanel

Webreinvent's laravel-cpanel package provides a fluent wrapper around the cPanel API (UAPI), letting you manage email accounts, databases, domains, FTP users, and more from your Laravel app with a clean, expressive PHP interface.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install the package with Composer, then publish its config if the package provides one:
    composer require webreinvent/laravel-cpanel
    php artisan vendor:publish --provider="WebReinvent\\CPanel\\CPanelServiceProvider"
    
  • Look first at config/cpanel.php, the package service provider, and the README for the exact facade/client name and method signatures. Configure the cPanel host, port, username, API token/password, and SSL verification in .env.
  • Use a low-risk read call first—list databases, email accounts, or subdomains—from php artisan tinker or a temporary route before attempting mutations.
  • First practical use case: tenant/site provisioning. Create a database, create a database user, assign privileges, and store the remote names locally. Since v1.3.8 fixes database user deletion, also verify the cleanup path in staging before relying on it.

Implementation Patterns

  • Wrap package calls in a dedicated service such as CpanelProvisioner or CpanelRepository. Keep controllers and Livewire components thin; inject the package client or your wrapper.
  • Queue write operations. cPanel calls are remote and can be slow; use jobs with timeouts and backoff. Be careful with retries: creates are not always idempotent, so check existence first or handle “already exists” responses explicitly.
  • Validate and normalize names before calling cPanel. Enforce length limits, allowed characters, and account-specific prefixes. Store both the requested name and the actual remote name returned by cPanel.
  • Use events/listeners or an audit log around provisioning operations. Log the operation, target account, sanitized request, response status, and remote identifier. Never log passwords or API tokens.
  • Build compensating workflows for multi-step operations. If database creation succeeds but user creation fails, drop the database; if user creation succeeds but privilege assignment fails, delete the user. v1.3.8’s database delete-user fix makes this cleanup path more reliable.
  • Cache read-only lists—databases, email accounts, subdomains—for dashboards and admin screens. Invalidate the cache after successful writes rather than polling cPanel on every page load.
  • For multi-server or reseller setups, avoid a single global credential. Resolve credentials per account/server from encrypted config or a secrets store, and bind a configured client per operation.
  • Add a scheduled reconciliation job that compares local records with cPanel’s lists. Alert on drift instead of silently recreating resources.
  • Test against a real cPanel test account for integration coverage, and mock your wrapper for unit tests. Add a regression test for deleting a database user after upgrading to v1.3.8.

Gotchas and Tips

  • cPanel APIs often return HTTP 200 with an error payload. Inspect the package response body/status fields, not just exceptions or HTTP codes.
  • API tokens and cPanel users need the right permissions. Feature Manager or hosting policies may disable database, email, or DNS functions even when the API call is correct.
  • Watch for cPanel’s automatic prefixes, especially MySQL database and user names. Do not assume the remote name equals the name you requested.
  • Deletion is destructive. Add confirmation, soft-delete/audit records, and a short retention window where possible. After v1.3.8, specifically test deleting users that own or are attached to databases.
  • Set explicit HTTP timeouts and prefer queues for writes. Avoid N+1 API calls in loops; batch or cache where the API allows it.
  • Keep credentials out of version control. Use Laravel’s encrypted config or environment secrets, and rotate tokens on a schedule.
  • SSL verification failures are common when using server IPs or self-signed hostnames. Fix the hostname/certificate rather than disabling verification globally.
  • Pin the package version in composer.json. v1.3.8 is a patch release with a database delete-user fix; no migration or breaking change is indicated, but run your provisioning and cleanup tests after upgrading.
  • Use extension points such as published config, custom service bindings, or HTTP middleware for logging/retry behavior rather than editing vendor files.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource