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

Base Bundle Laravel Package

sidus/base-bundle

Sidus BaseBundle for Symfony streamlines service loading and routing via action services, simplifies param converters, and adds helpful compiler passes and utilities. Includes DateTime/translation helpers, validator constraint loader, and form type extensions.

View on GitHub
Deep Wiki
Context7

Sidus/BaseBundle Documentation

Service loading

If you simply inherit from the SidusBaseExtension, all the YAML files present in this directory will be loaded: ./Resources/config/services

<?php

namespace FooBarBundle\DependencyInjection;

use Sidus\BaseBundle\DependencyInjection\SidusBaseExtension;

class FooBarExtension extends SidusBaseExtension
{
}

Routing

Instead of using controllers, declare service for each action and then you just have to declare the routing like this:

FooBarBundle\Action\MyAction: # Route name must match service id
    path: /path/{parameter}

You don't need to declare the _controller part, it will be loaded with your route name.

Param converter

Take a look at the AbstractParamConverter, declaring param converter is much more simple now

Compiler passes

The GenericCompilerPass allows you to easily inject all services tagged with a specific tag into another service.

Utilities

DateTime parsing

DateTimeUtility::parse will allow you to parse date time from multiple formats easily.

Translation

Use the TranslatorUtility to iterate over various translation keys in order to return the first matching one.

Validator

You can use the BaseLoader class to load a sets of constraints from a PHP array with the same syntax than Yaml:

<?php
/** @var ValidatorInterface $validator */

use Sidus\BaseBundle\Validator\Mapping\Loader\BaseLoader;use Symfony\Component\Validator\Validator\ValidatorInterface;

$loader = new BaseLoader();

$constraints = $loader->loadCustomConstraints([
    ['Regex' => ['pattern' => '/^[a-z0-9]+(?:[-\_][a-z0-9]+)*$/']],
    ['NotNull' => null],
]);

foreach ($constraints as $constraint) {
    $violations = $validator->validate($data, $constraint);
    // Do stuff with the violations
}

Forms

The ChoiceTypeExtension allows choice form types to work with iterable objects. You don't need to do anything.

A new option is available for any form type: block_prefix allows you to directly choose a custom block prefix for form rendering.

Serializer

See SidusBaseSerializerBundle for additional support.

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.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views