You can write your own service,
For example, create a folder name in your bundle.
Service
Then create a php inside
MyClass.php
namespace .....BundleService;
class MyClass
{
function HelloWord($value)
{
return 'hello'.$value;
}
}
Add in config.yml
parameters:
myclass.class: ..\..Bundle\Service\MyClass
myclass.value: value
You can write your own service, For example, create a folder name in your bundle. Service Then create a php inside MyClass.php namespace .....BundleService; class MyClass
function HelloWord($value)
{
return 'hello'.$value;
}
}
Add in config.yml
parameters:
services:
When using it, write it in the controller
$myclass= $this->get('myclass');
echo $myclass->HelloWord("world");
Detailed explanations are available on the official website http://symfony.com/fr/doc/current/book/service_container.html