Weave Code
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

Tinypng Bundle Laravel Package

bolser/tinypng-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer:

composer require vendor/package-name

The package now officially supports Symfony 4/5 alongside Laravel, making it compatible with projects using Symfony components (e.g., HTTP clients, HTTP kernel, or dependency injection). For Laravel-specific usage, follow the existing docs—no changes are required. Test in a fresh Laravel project to verify compatibility.

Implementation Patterns

Symfony Integration

If your project uses Symfony components (e.g., symfony/http-client, symfony/mailer), leverage the package’s updated composer.json to avoid conflicts. Example:

// Use Symfony's HttpClient within Laravel (if needed)
use Symfony\Component\HttpClient\HttpClient;
$client = HttpClient::create();
$response = $client->request('GET', 'https://api.example.com');

Laravel-Centric Workflows

For pure Laravel projects, the package’s core functionality remains unchanged. Focus on:

  1. Service Providers: Register the package in config/app.php under providers.
  2. Facade/Helper Methods: Use the package’s facades (if provided) for concise syntax:
    use Vendor\Package\Facades\PackageFacade;
    $result = PackageFacade::action();
    
  3. Configuration: Publish and customize configs via:
    php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider"
    

Gotchas and Tips

Composer Dependency Conflicts

  • Symfony Version Locking: The composer.json update may pull in newer Symfony dependencies. Pin versions explicitly in composer.json if your project requires specific Symfony versions:
    "require": {
        "symfony/http-client": "^5.4",
        "vendor/package-name": "^1.1"
    }
    
  • Laravel Compatibility: Test thoroughly in Laravel 8/9/10. While the package supports Symfony 4/5, Laravel’s DI container may still interact with Symfony components in unexpected ways.

Debugging

  • Class Not Found Errors: If using Symfony classes directly, ensure autoloading is configured. Run:
    composer dump-autoload
    
  • Facade Issues: Clear Laravel’s cached facades if changes aren’t reflected:
    php artisan cache:clear
    php artisan config:clear
    

Extension Points

  • Custom Symfony Bindings: Extend the package by binding Symfony services to Laravel’s container in a service provider:
    public function register()
    {
        $this->app->singleton(SymfonyService::class, function ($app) {
            return new SymfonyService();
        });
    }
    
  • Event Listeners: If the package dispatches Symfony events (e.g., KernelEvents), listen to them in Laravel’s EventServiceProvider:
    protected $listen = [
        \Symfony\Component\HttpKernel\Event\KernelEvents::REQUEST => [
            \Vendor\Package\Listeners\HandleRequest::class,
        ],
    ];
    
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.
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment