PHP code example of sidus / base-bundle
1. Go to this page and download the library: Download sidus/base-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sidus / base-bundle example snippets
namespace FooBarBundle\DependencyInjection;
use Sidus\BaseBundle\DependencyInjection\SidusBaseExtension;
class FooBarExtension extends SidusBaseExtension
{
}
/** @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
}