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

Socialite Cn Laravel Package

liaol/socialite-cn

liaol/socialite-cn extends Laravel Socialite with OAuth providers for popular Chinese platforms such as WeChat, QQ, Weibo, and Alipay, making it easier to add social login to Laravel apps. It offers a familiar Socialite API, provider configuration, and support for common Chinese identity services.

View on GitHub
Deep Wiki
Context7

Getting Started

This release (1.0.9) is a compatibility patch: the service provider now registers its binding with singleton() instead of the deprecated/removed bindShared(). That means the package works cleanly on Laravel 5.2+ (where bindShared was removed) while remaining compatible with 5.0/5.1 (singleton() has existed since 4.x). There is no new configuration and no public API change, so upgrading from 1.0.8 is a drop-in composer update.

Minimal steps:

  1. Require the package: composer require <vendor>/<package>:^1.0.9.
  2. Register the provider if you are on Laravel <5.5 (no package auto-discovery): add it to the providers array in config/app.php. On 5.5+ discovery handles it, but verify with php artisan package:discover after install.
  3. Confirm the binding resolves: php artisan tinker then app(<PackageService>::class). You should get a single instance back; calling it twice should return the same object identity (that is the whole point of the bindShared → singleton change).
  4. Publish config/assets only if the package ships them: php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider". Look at the package's README/src/*ServiceProvider.php first — the register() method tells you the binding key, whether it is aliased, and whether it is deferred.
  5. First real use case: type-hint the package's service (or its contract) in a controller constructor or a queued job and let the container inject it. Because it is a singleton, any state the service holds is shared for the lifetime of the request/process.

Where to look first when something feels off: the provider's register()/provides() methods, then config/<package>.php. Those two files answer 90% of "why isn't this resolving" questions.

Implementation Patterns

Constructor injection over facades. Resolve the package service through the container in constructors, jobs, listeners, and artisan commands. This keeps it swappable in tests and avoids the static coupling a facade introduces. If the package ships a facade, treat it as sugar for Blade/views and quick scripts only.

Bind an interface, resolve the contract. If the package exposes a contract, type-hint the interface and let the package's provider supply the concrete class. If you need to decorate it (logging, caching, tenant scoping), rebind in your own AppServiceProvider::register() after the package provider has run:

$this->app->extend(PackageContract::class, function ($service, $app) {
    return new DecoratedService($service);
});

Testing. In setUp() or a test, swap the singleton for a fake with $this->app->instance(PackageContract::class, $fake). Because it is a singleton, the instance you set persists for the whole test case — which is convenient, but it also means state written by one test can bleed into the next if you reuse the application instance. Prefer RefreshDatabase/fresh app per test, and assert instance identity deliberately when the singleton semantics matter.

Config-driven wiring. Anything the package reads at register() time is frozen into the singleton. If you need per-environment behaviour, set config in config/<package>.php or via .env before the provider registers — mutating config at runtime after resolution will not reconfigure an already-built singleton.

Long-running processes (Octane, queue workers, Swoole). A singleton lives for the worker, not the request. If the package service accumulates request-scoped data (current user, tenant, request payload), either reset it in a middleware/Octane::tick hook or rebind it as scoped in a small service provider of your own so each request gets a fresh instance.

Version pinning. Since the fix targets Laravel 5.2 compatibility, pin ^1.0.9 in composer.json if your app is on 5.2+ and you were previously stuck on an older release or a fork. If you maintain a Laravel 5.0/5.1 app, ^1.0.9 is still fine — singleton() is supported there.

Gotchas and Tips

  • This is not a breaking change for consumers. bindShared() and singleton() both resolve to the same "one shared instance" behaviour; only the container API used internally changed. The upgrade risk is essentially zero unless you were overriding the provider's register().
  • bindShared removal is the whole story. On Laravel 5.2 the old code threw a BadMethodCallException / "method does not exist" at boot. If you saw a fatal error during package:discover or provider registration on 5.2, this release is the fix. Any stack trace pointing at Container::bindShared confirms it.
  • Issue #12 has no detail in the notes. Check the package's GitHub issue tracker / CHANGELOG before upgrading in a critical path — a "fix" bundled with a compatibility change can occasionally alter resolution timing or binding keys. Diff 1.0.8...1.0.9 if you have fork or vendor overrides.
  • Singleton ≠ shared across processes. Under PHP-FPM the singleton is per-request; under queue workers and Octane it survives between jobs/requests. Test the latter explicitly if the service holds mutable state.
  • Deferred providers. If the package provider is deferred, the binding is only registered when first resolved. That's usually fine, but it means $this->app->bound(...) can be false early in the lifecycle. Don't assert on binding existence in a service provider's boot() without resolving first.
  • Debugging resolution. app()->bound(Key::class), app()->make(Key::class), and app()->resolved(Key::class) are your fastest tools. To confirm singleton behaviour, resolve twice and compare with spl_object_id() or ===.
  • Extension point. $this->app->extend() is the sanctioned way to decorate the package service without forking the provider; $this->app->instance() is the sanctioned way to fake it in tests. Reaching into the provider's private properties is a smell that means you should be binding your own abstraction in front of it.
  • Config caching. php artisan config:cache will bake in whatever the provider reads at boot; clear it (config:clear) after changing package config or you'll debug a ghost.
  • Composer lock discipline. Because this is a patch-level bump with a framework-version motivation, run composer update <vendor>/<package> --with-dependencies and commit the lock file so CI and production agree on the 1.0.9 fix.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource