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.
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:
composer require <vendor>/<package>:^1.0.9.providers array in config/app.php. On 5.5+ discovery handles it, but verify with php artisan package:discover after install.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).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.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.
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.
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.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.$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.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 ===.$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.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 update <vendor>/<package> --with-dependencies and commit the lock file so CI and production agree on the 1.0.9 fix.How can I help you explore Laravel packages today?