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

Nullable Embeddable Bundle Laravel Package

andanteproject/nullable-embeddable-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer with updated Symfony constraints:

composer require vendor/package-name "^1.0"

The package now officially supports Symfony 8.x alongside existing versions. Verify compatibility by checking the composer.json constraints for:

  • symfony/config (^6.0|^7.0|^8.0)
  • symfony/http-kernel (^6.0|^7.0|^8.0)
  • symfony/dependency-injection (^6.0|^7.0|^8.0)
  • symfony/property-access (^6.0|^7.0|^8.0)
  • symfony/cache (^6.0|^7.0|^8.0)
  • symfony/framework-bundle (^6.0|^7.0|^8.0)

First use case: If migrating a Laravel app to Symfony 8 (e.g., for shared components), test the package in a fresh symfony/skeleton (v8) project to validate integration.


Implementation Patterns

Symfony 8 Integration

  1. Dependency Injection (DI) Changes:

    • Symfony 8 introduces autowiring improvements (e.g., AutoconfigurePass enhancements). If the package uses DI, ensure your service definitions align with Symfony 8’s stricter autowiring rules (e.g., avoid ambiguous constructor arguments).
    • Example: If the package provides a Service class, update its constructor to explicitly type-hint dependencies:
      public function __construct(
          private ConnectionInterface $connection,
          private LoggerInterface $logger
      ) {}
      
  2. Property Access Component:

    • Symfony 8’s PropertyAccess component may expose new features (e.g., stricter property access validation). Test edge cases like:
      $accessor = PropertyAccess::createPropertyAccessor();
      $accessor->getValue($object, '[nonExistentProperty]'); // Symfony 8 may throw stricter exceptions.
      
  3. Cache System:

    • If the package uses Symfony’s Cache component, leverage Symfony 8’s tagged cache invalidation or PSR-16 compliance for performance optimizations:
      $cache = new PoolCache($cacheItemPool);
      $cache->get('key', function() { return computeExpensiveValue(); });
      
  4. HTTP Kernel:

    • For packages interacting with Symfony’s HTTP layer (e.g., middleware, controllers), Symfony 8’s HttpKernelInterface may have updated method signatures. Verify:
      $response = $kernel->handle($request, HttpKernelInterface::MAIN_REQUEST);
      

Laravel-Specific Workflows

  • No Breaking Changes for Laravel: Since Laravel 10+ uses Symfony 6/7 components, this update primarily benefits:
    • Projects using Symfony 8 for shared libraries (e.g., microservices).
    • Developers integrating the package into non-Laravel Symfony apps.
  • Testing: Use Laravel’s symfony/http-client (v6/7) or Symfony 8’s HttpClient interchangeably if the package supports both.

Gotchas and Tips

Symfony 8-Specific Pitfalls

  1. Strict Types and Deprecations:

    • Symfony 8 removes deprecated APIs (e.g., ContainerInterface::getParameterBag()). Update calls to:
      $container->getParameter('param'); // Replaced with $container->get('param') in some cases.
      
    • Enable Symfony’s strict_types=1 in composer.json to catch type-related issues early.
  2. Cache Component Changes:

    • Symfony 8’s CacheItemPoolInterface may enforce stricter expiration logic. Test with:
      $item = $pool->getItem('key');
      $item->expiresAfter(3600); // Ensure this works as expected.
      
  3. Property Access:

    • Symfony 8 tightens security around property access. Avoid dynamic property names unless explicitly allowed:
      // Risky in Symfony 8:
      $accessor->getValue($obj, '[user.' . $dynamicKey . ']');
      
  4. CI/CD Considerations:

    • Update GitHub Actions to test against Symfony 8:
      jobs:
        test:
          runs-on: ubuntu-latest
          strategy:
            matrix:
              symfony: ['7.4.*', '8.0.*']
      

Extension Points

  • Custom Symfony 8 Features:

    • If the package uses Symfony’s Attribute system (introduced in Symfony 6), leverage Symfony 8’s improved attribute handling for metadata (e.g., @Route annotations).
    • Example:
      #[Route('/example', name: 'example')]
      public function index(): Response { ... }
      
  • Performance:

    • Symfony 8’s HttpClient supports HTTP/3 and connection pooling. If the package makes HTTP requests, benchmark performance gains:
      $client = HttpClient::create(['http_version' => '2']);
      

Debugging Tips

  • Symfony Profiler: Use Symfony 8’s WebProfilerBundle to inspect:
    • Dependency injection containers.
    • Cache hits/misses.
    • Property access operations.
  • Error Handling: Symfony 8’s error pages are more detailed. Check var/log/dev.log for stack traces if the package fails silently.

Laravel-Specific Notes

  • No Action Required: For pure Laravel projects, this update is non-breaking. Focus on Symfony 8 integration only if:
    • You’re building a hybrid Laravel/Symfony app.
    • The package is used in a Symfony 8 microservice consumed by Laravel.
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.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware