Skip to content
alzafchat / Developers

Documentation / Integrations

Laravel package

Install the backend in your own Laravel application.

Integration guide
On this pagePrivate GitHub VCS installationMonorepo path development

Requires PHP8.3+ and Laravel12. The local path installation is verified by the runnable API example. This package is private and proprietary; it is not published to Packagist. Existing third-party dependency licenses remain unchanged.

Private GitHub VCS installation#

The same monorepo exposes service-chat/laravel-chat from its root Composer manifest; PSR-4 resolves ServiceChat\\ to packages/laravel-chat/src/. The nested package manifest remains canonical for workspace development. Git tags supply versions; neither manifest hardcodes a release version.

Give the installing developer or build identity read access to the private Alzaf-IT/alzaf_chat repository. Configure Composer's github-oauth.github.com in a private Composer auth file using a secure editor or your CI secret facility. The credential needs access to this repository; keep it outside the repository and public web roots, restrict file access, and never put the token in a shell argument, documentation, screenshot or committed auth.json. Composer will use that credential for private GitHub metadata/downloads. Authentication failure does not grant repository access; verify the identity's repository permissions.

From your Laravel host:

sh
composer config repositories.alzaf-chat vcs https://github.com/Alzaf-IT/alzaf_chat.git
composer require service-chat/laravel-chat:0.1.13

The versioned command requires the repository's v0.1.13 tag; it cannot resolve before that release is tagged. These commands add a private VCS repository to the host rather than publishing a package to Packagist. Private VCS installation in an external clean host remains a separate verification step. Then complete the host-adapter and Reverb steps below; installing this package does not create production authentication or provision a running central server.

A separate clean Laravel skeleton 12.0.0 on PHP 8.3.30 / Composer 2.9.5 was verified with the root distribution ZIP via Composer's local artifact repository, resolving Laravel framework 12.69.3. The artifact alone had fixture version 0.1.0; source manifests remained tag-versioned. It installed through vendor autoload, automatically discovered ServiceChat\\ChatServiceProvider, published service-chat-config, migrated the package sc_* tables into a fresh SQLite database and registered the authenticated api/chat routes. That check predates attachments: the sc_attachments migration, the attachment upload/negotiation routes and the signed download route were added afterwards and are covered by the example feature tests and local package builds, not yet by a repeated clean-host installation. The clean check used neither the nested workspace path repository nor the example's account controllers. Private GitHub credentials, tagged VCS retrieval and host-specific authorization remain separate checks. No production database or storage participated.

Maintainers check metadata using php scripts/verify-composer-distribution.php; after a deliberate nested manifest change, regenerate with --write and review the root diff. composer validate --strict checks the root manifest. To inspect the committed release contents:

sh
git archive --format=tar --output=/private/path/chat-release.tar HEAD
php scripts/verify-composer-distribution.php --archive=/private/path/chat-release.tar

Archive verification requires every package source/config/migration file and matching metadata, tolerates Git's CRLF normalization, and rejects unrelated examples, documentation, deployment, agent and JavaScript tooling. .gitattributes defines these Git archive exclusions. GitHub's generated distribution archive and a real private Composer installation still need release verification; do not assume Git export attributes alone prove GitHub's download contents.

Monorepo path development#

From a Laravel host inside this monorepo, add a Composer path repository pointing to ../../packages/laravel-chat and require the local development branch that the host checks out, then run composer install. The runnable example accepts the repository's supported CI branches (dev-frontend and dev-laravel-api) as well as its active development branch; adapt that constraint if your host uses another branch. This is a local development branch reference, not a published release. Package discovery loads routes and migrations automatically.

  1. Implement HostAdapter for the host's authenticated identity/provider directory.
  2. Publish config: php artisan vendor:publish --tag=service-chat-config.
  3. Set service-chat.adapter to your class and middleware to the host's authenticated API middleware. Do not reuse demo credentials or trust browser role/service fields.
  4. Run php artisan migrate. Prefix tables are described in data model; attachments add sc_attachments through a forward migration.
  5. Choose attachment storage. It defaults to your FILESYSTEM_DISK, so an S3-default host needs nothing extra; the disk must be private. For direct browser-to-S3 uploads the bucket needs PUT CORS for each frontend origin, and a lifecycle rule on the service-chat/ prefix is the supported cleanup for abandoned objects. See configuration. Without CORS the SDK falls back to proxy uploads, which still work.
  6. Install Laravel Reverb in the host, configure server-side broadcasting credentials, register an authenticated Broadcast::auth endpoint, and run Reverb plus the queue worker. The example configs are a bearer/local reference, not a production secret template.
  7. Point the SDK/widget/framework adapter at your API prefix and auth callback; use the public Reverb key/host/port and your broadcast auth endpoint.
  8. Validate a customer creation, provider reply, admin join, cross-provider/service denial, private subscription, an image attachment, a PDF attachment and an attachment-only message in the actual host.

Existing host models remain authoritative; the package does not require a users foreign key or commerce tables. Provider teams are resolved via host identity; one active provider/service context per request is supported. Cookie/session and Sanctum integration are not yet verified; use the adapter contract and test your authentication boundary.

The example demo central API uses the same installed package. External stacks can consume API but cannot install this Composer package natively. Production central-server service onboarding and authenticated server-to-server identity exchange are deferred. See API and realtime for contract limitations.