Since this is a Symfony bundle, Laravel developers must bridge it via Symfony components or a Laravel-Symfony bridge (e.g., symfony/panther for testing or laravel-symfony-bridge for partial integration). For a true Laravel workflow, focus on its core features (search, GraphQL, content indexing) and adapt them via:
Composer Dependency
composer require sitepark/atoolo-citygov-bundle
Note: Requires Symfony 6.3+ or a Laravel-Symfony interop layer.
Configuration
Add to config/bundles.php (Symfony) or manually register services in Laravel’s AppServiceProvider:
// config/bundles.php (Symfony)
return [
Sitepark\Atoolo\CityGovBundle\CityGovBundle::class => ['all' => true],
];
First Use Case: Searchable Employee Directory
Leverage the search & suggest for citygov persons (v1.5.0) feature:
// Symfony Controller Example (adapt for Laravel)
use Sitepark\Atoolo\CityGovBundle\Service\PersonSearchService;
class EmployeeController extends AbstractController
{
public function search(PersonSearchService $personSearch): Response
{
$results = $personSearch->search('John Doe', ['sort' => 'name']);
return $this->json($results);
}
}
Laravel Alternative: Use the underlying atoolo/search-bundle (dependency) via a facade or service container.
GraphQL Online Services
Enable the OnlineServiceFeature (v1.4.0) for headless service APIs:
# Example GraphQL Query (Symfony)
query {
onlineServices {
id
title
link
}
}
Laravel Integration: Use graphql-php to mirror the schema.
Content Indexing Automate SEO-friendly URLs with index-document generation (v1.4.0):
# config/packages/atoolo_citygov.yaml (Symfony)
atoolo_citygov:
index_documents:
enabled: true
alternate_titles: ['English', 'Français']
PersonSearchService for custom filters:
$results = $personSearch->search(
'term',
['filters' => ['department' => 'HR'], 'sort' => 'last_name']
);
atoolo/search-bundle:
$searchClient = $this->container->get('atoolo_search.client');
$query = new \Atoolo\SearchBundle\Query\SearchQuery();
$query->addCriteria('name', 'John');
$results = $searchClient->search($query);
use Sitepark\Atoolo\CityGovBundle\Service\PersonSuggestService;
$suggestions = $personSuggestService->suggest('Jo', 5);
// Returns: ['John Doe', 'Joanna Smith', ...]
OnlineServiceFeature in Symfony:
# config/packages/atoolo_citygov.yaml
atoolo_citygov:
graphql:
online_service_feature: true
query {
onlineServices(limit: 10) {
edges {
node {
id
title
description
link
}
}
}
}
graphql-php to define a similar schema:
$schema = new \GraphQL\Type\Definition\ObjectType([
'name' => 'OnlineService',
'fields' => [
'title' => ['type' => Type::string()],
'link' => ['type' => Type::string()],
],
]);
# config/packages/atoolo_citygov.yaml
atoolo_citygov:
index_documents:
enabled: true
alternate_titles: ['English', 'Français']
sp_meta_string_leikanumber) to documents for government compliance.use Sitepark\Atoolo\CityGovBundle\EventListener\DocumentEnricher;
// Symfony Event Listener (adapt for Laravel)
public function onDocumentEnrich(DocumentEnrichEvent $event)
{
$event->getDocument()->setMeta('leikanumber', '12345');
}
last_name, department).$results = $personSearch->search(
'term',
['sort' => ['field' => 'department', 'direction' => 'asc']]
);
// In AppServiceProvider::boot()
$this->app->singleton(PersonSearchService::class, function ($app) {
return new PersonSearchService(
$app->make('atoolo_search.client'),
// ... other dependencies
);
});
namespace App\Http\Resources;
use Sitepark\Atoolo\CityGovBundle\Entity\Person;
use Illuminate\Http\Resources\Json\JsonResource;
class PersonResource extends JsonResource
{
public function toArray($request)
{
return [
'name' => $this->name,
'department' => $this->department,
'phone' => $this->phoneNumber, // Fixed in v1.5.0
];
}
}
bundles.php; Symfony bundles won’t auto-register.AppServiceProvider:
public function register()
{
$this->app->register(\Sitepark\Atoolo\CityGovBundle\CityGovBundle::class);
}
Alternative: Use spatie/laravel-symfony-bridge for partial integration.EventDispatcher isn’t natively in Laravel.// Symfony Listener (e.g., DocumentEnricher)
public static function getSubscribedEvents()
{
return [
DocumentEnrichEvent::class => 'onDocumentEnrich',
];
}
Laravel Alternative: Dispatch a custom event:
event(new DocumentEnriching($document));
atoolo/search-bundle). Elasticsearch requires custom config.
How can I help you explore Laravel packages today?