1. Go to this page and download the library: Download c975l/services-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/ */
c975l / services-bundle example snippets
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// ...
new c975L\ServicesBundle\c975LServicesBundle(),
];
}
}
use c975L\ServicesBundle\Service\ServiceImageInterface;
class YourClass
{
private $imageService;
public yourMethod(ServiceImageInterface $imageService)
{
//Do your stuff...
//Resizes image
$imageService->resize($file, string $folder, string $filename, string $format = 'jpg', int $finalHeight = 400, int $compression = 75, bool $square = false, $stamp = null);
}
}
use c975L\ServicesBundle\Service\ServiceToolsInterface;
class YourClass
{
private $toolsService;
public yourMethod(ServiceToolsInterface $toolsService)
{
//Do your stuff...
//Create flash
$toolsService->createFlash(string $translationDomain = null, string $text, string $style = 'success', array $options = array());
}
}
use c975L\ConfigBundle\Service\ConfigServiceInterface;
class YourClass
{
private $configService;
public function __construct(ConfigServiceInterface $configService)
{
$this->configService = $configService;
}
public function yourMethod()
{
$extensions = file($this->configService->getContainerParameter('kernel.project_dir') . '/../vendor/c975l/services-bundle/Lists/extensions.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if (in_array('txt', $extensions)) {
//Do your stuff
}
}
}