Download the PHP package bankiru/seo-engine without Composer
On this page you can find all versions of the php package bankiru/seo-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package seo-engine
Banki.ru SEO Engine
General purpose SEO library for standalone usage (Symfony DI included)
Purpose
- Processing general SEO data
- SEO links generation
- Sitemap generation
Installation
Terminology
Matching
- Destination — is a route identifier and set of concrete entities indexed by placeholder codes
- Complete TargetSpace — is a set of all possible destinations for the given route identifier
- Condition — a binary predicate, can return Destination weight on successful match
- TargetSpaceDefinition — is a (sub)set of complete TargetSpace, defined by a set of Conditions
Generation
- Source — is any countable and iterable source of entities, which could be filtered with Condition
- Filler — (in general) function that infers missing values into Destination
Usage
Standalone
For general standalone usage you have to implement (or use out-of-the-box static collection implementations) three services:
- Destination - An item to match by SEO engine
- TargetDefinitionRepositoryInterface - A source of TargetSpaces indexed by routes
- PageRepositoryInterface - Matcher of SeoPageInterface by matched TargetSpace and initial Destination
Generic flow
Symfony integration
This library has built-in integration into symfony request processing flow and DI, so the kernel takes the most of the work above for you
If you define options: {seo: true}
for your route, then you can obtain SEO page immediately
with following signature
This will throw an exception for you automatically.
Configuration
Routing
Configure route options like following
To enable listeners for this route
Integrations
Local static matching
To bootstrap data configuration there is a local implementation of necessary interface, which allows to start using the library immediately pre-filling the repositories from init\config code.
Doctrine ORM matching
You can implement the necessary interfaces ontop of your entity repositories. Make sure the entities implement required interfaces (target, condition, etc)
Link generation
In order to use link generation ability, you have to define two
- Fill source registry with
SourceInterface
entities indexed by alias - Create Link compiler which can forge a url using the route identifier from link and the destination items as
Sluggable
s
As a part of Symfony integration where is the SymfonyRouterCompiler
which uses the UrlGenerator
to compile the link reference
Extensions
You can override, decorate and replace the following extension points to tune your SEO processing experience
Matching
TargetRepositoryInterface
- finds the all matching targets for given routeTargetSorter
- chooses single target from all fetched above by matching with destinationPageRepositoryInterface
- finds the SEO page for target and destination
Generation
DestinationNormalizer
- converts your entity into string for slug generation.SluggableNormalizer
normalizer is the primary option for objects,ScalarNormalizer
is used for all the scalarsDestinationCompiler
- forges your destination into the link (href, title and attributes).SymfonyRouterCompiler
is the primary default option if symfony availableSourceInterface
- source of the data to create destinations. No default option,CollectionSource
is the built-in oneSourceFiller
- extend missing entries in destination from source-generated values. Not required, thus no defaults