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

Starcraft Connection Layer Laravel Package

petrepatrasc/starcraft-connection-layer

A PHP connection layer for StarCraft that provides a structured foundation for managing connections and integrating StarCraft-related communication into PHP applications. It keeps connection concerns separate from application logic for cleaner, more maintainable integrations.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with Composer and let Laravel's package auto-discovery register the service provider.
  • Publish the package config (php artisan vendor:publish --provider="...\ConnectionServiceProvider") and review the default connection settings before making your first call.
  • Look first at the published config and the ConnectionService class. As of 1.0.1 the main service was renamed to ConnectionService, so this is the class name you should resolve from the container (or via its facade).
  • First use case: inject ConnectionService into a controller or job and open/use the default connection.
use Vendor\Package\ConnectionService;

public function __construct(private ConnectionService $connections) {}

public function show()
{
    return $this->connections->connection()->send($payload);
}

Implementation Patterns

  • Constructor injection over helpers. Type-hint ConnectionService in controllers, jobs, and services so the dependency is explicit and swappable in tests.
  • Named connections. Define multiple connections in config and select them per call ($connections->connection('reports')); keep environment-specific credentials in .env.
  • Facade for quick calls, injection for business logic. Facades are convenient in tinker/controllers but make unit testing harder; prefer the injected service in domain code.
  • Testing. Swap the service in the container ($this->swap(ConnectionService::class, $fake)) or bind a fake in a service provider; avoid hitting real connections in tests.
  • Long-running work. Put connection usage behind queued jobs so timeouts and retries are handled by the queue rather than blocking requests.
  • Post-rename migration. After upgrading to 1.0.1, update every reference to the old service name: use statements, constructor/property type hints, app('old-name') and make() strings, facade accessors, and any custom container bindings.

Gotchas and Tips

  • Breaking rename in 1.0.1. The main connection service is now ConnectionService. Grep the codebase for the previous class name and update imports, DI hints, container string keys, facade accessors, and any config that referenced it. Third-party code extending or type-hinting the old class will break.
  • Config caching. After publishing or editing connection config, run php artisan config:clear locally and ensure a config rebuild happens on deploy, otherwise changes silently don't apply.
  • Singleton staleness. If the service is bound as a singleton, queue workers and Octane processes can hold stale connections. Reconnect or reset per job/request, or bind transiently where appropriate.
  • Timeouts and retries. Configure these per connection rather than globally; a single slow endpoint shouldn't inherit the default for everything.
  • Debugging. Log the resolved connection name and enable any package debug flag when diagnosing failures; confirm the correct connection is being selected before digging into credentials.
  • Extension points. Bind your own implementation to the container (before the provider boots) if you need custom behaviour, and check whether the package exposes events/hooks for connection lifecycle rather than wrapping calls yourself.
  • Version pinning. Because 1.0.1 contains a rename, pin the version in composer.json and review the changelog before jumping minor/major versions in production.
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.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package