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

Select2 Form Bundle Laravel Package

stinger-soft/select2-form-bundle

A Symfony form bundle that adds Select2-powered autocomplete, tagging, and AJAX-loaded choice fields to your forms, with minimal configuration and sensible defaults.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by confirming what the package actually gives you before wiring it into anything: read the README, then the src/ root for the service provider and any facade, then config/ for the published config file. In a 0.x release the README is the contract — the code is the truth.

Minimal steps:

  1. composer require vendor/package and check whether the service provider and facade are auto-discovered (extra.laravel in the package's composer.json). If they are, do not register them manually in config/app.php — duplicate registration is a common source of "why is this booted twice" confusion.
  2. Publish only what you need: php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider" --tag=config and, separately, --tag=migrations if migrations ship with it. Publishing everything dumps assets and stubs you'll never touch.
  3. If migrations are published, run php artisan migrate and immediately check the generated table names/columns against the package's expectations — published migrations in young packages sometimes drift from what the code queries.
  4. Drop a single call into a tinker session or an existing feature test to prove the container binding resolves:
$service = app(\Vendor\Package\Contracts\ThingContract::class);
dump($service);

First use case: pick the narrowest thing the package does and exercise it inside an existing test rather than a scratch route. For most Laravel packages that means resolving the contract from the container, passing a real Eloquent model (not an array), and asserting the side effect — a row, a dispatched job, an outgoing HTTP request.

Implementation Patterns

Bind to the contract, not the class. Packages that are worth using expose an interface. Type-hint the contract in your constructors and controllers; let the provider decide the implementation. This is also what makes the package swappable if 0.1 turns out to be a dead end.

Wrap it in your own thin adapter. For anything you call from more than two places, put a small app-level class in front of the package:

final class ShipmentGateway
{
    public function __construct(private readonly \Vendor\Package\Contracts\Shipper $shipper) {}

    public function dispatch(Order $order): string
    {
        return $this->shipper->create($order->toPackagePayload())->id;
    }
}

The adapter is where you absorb signature churn between 0.1 and 0.2, and where you normalise the package's exceptions into your app's domain exceptions.

Fake it in tests. If the package ships a Package::fake() or a testing trait, use it for feature tests and keep one or two integration tests that hit the real implementation. If it ships no fake, bind a mock of the contract in a base test case or a TestCase::setUp override rather than reaching for Http::fake() around its internals.

Queue and events. Packages that do I/O usually dispatch jobs or events. Check whether the package's own jobs are queueable and whether they carry a $connection/$queue you want to override. If you need to react to package events, register listeners in a dedicated EventServiceProvider rather than in the package's config — that keeps the reaction discoverable during code review.

Config over code where available. Most behaviour toggles should live in config/package.php and be driven by env vars, so staging and production can differ without a deploy. When a setting isn't exposed, that's a good first upstream PR.

Integration tip: add the package's config keys to your .env.example and any deployment docs in the same PR that adds the dependency. Six months from now the person debugging will not know which of the twelve keys are load-bearing.

Gotchas and Tips

0.x means no semver promise. Pin the version ("^0.1", not "*") and read the changelog before every bump. Treat any 0.2 as potentially breaking regardless of what the release notes claim.

config:cache will bite you. If you read config at boot time in a service provider, php artisan config:cache can freeze a value that later changes in .env. Read config inside methods, not in register()/boot() stored properties, and re-run php artisan config:clear when behaviour looks stale.

Publishing is one-way-ish. vendor:publish overwrites without warning by default. Commit the published config and migrations to your repo before you start editing them, so git diff shows what the package shipped versus what you changed — that diff is your upgrade guide.

Migration ordering. If the package's migrations reference your users or orders table, they must sort after yours. Rename the published migration timestamp if the package ships a date that lands mid-way through your own migration run, and re-check after every migrate:fresh.

Facade static calls hide the dependency. They're convenient in Blade and quick scripts, but in application code use injection so tests can swap implementations. If IDE autocompletion for the facade is missing, add the @method docblock — many 0.x packages forget it.

Debugging order: confirm the provider is registered (php artisan about or php artisan package:discover -v), confirm the config file exists in config/ after publishing, confirm the container resolves the contract, and only then look at the package's actual logic. Ninety percent of "the package doesn't work" reports stop at step one.

Extension points to look for: a Manager-style class with extend(), a drivers config array, or an event dispatched before the main action. If the package dispatches a pre-action event, that is your supported hook for customisation — much safer than subclassing an internal class, which 0.2 will rename.

When to stop leaning on it. If you find yourself forking vendor files, reimplementing the package's core in a wrapper, or patching around three separate gotchas in the first week, that's the signal to evaluate whether the package is pulling its weight at 0.1.

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.
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
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect