Download the PHP package umanit/seo-bundle without Composer

On this page you can find all versions of the php package umanit/seo-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package seo-bundle

Umanit Seo Bundle

This bundle adds SEO capabilities for any model entities.

Features

Installation

$ composer require umanit/seo-bundle

Configuration

The template needs to be declared in your Twig configuration, before other templates. You must choose one between:

You can configure your bundle further by creating a umanit_seo.yaml configuration file. Here is the default configuration provided by the bundle:

Usage

  1. Basic Usage
  2. Seo Metadata
  3. Schema.org
  4. Breadcrumb
  5. Enabling 301 redirects
  6. Twig functions reference
  7. Protips

Basic usage

In order to function properly, SeoBundle must be able to generate a URL for a given entity. To do so, the umanit_seo.routable service uses handlers to process the entity.

A handler is a service which implements Umanit\SeoBundle\Handler\Routable\RoutableHandlerInterface. A supports method indicated if the service can handle the given entity and a process method do the job by returning a Umanit\SeoBundle\Model\Route object.

The Umanit\SeoBundle\Model\Route object has a name attribute, which is the name of the route used to access the entity and a parameters attribute used to build the route.

You must implement the interface Umanit\SeoBundle\Model\RoutableModelInterface on your entity and create a handler to process it.

SeoBundle will now be able to generate a URL from the entity. If you ever change the slug of a page, the old URL will be redirected to the new one.

If you wanted to generate the URL by yourself you would have done something like the following example:

You can now do like so:

Note: You can use the canonical() function without passing it an entity, SeoBundle will automatically resolve the entity associated to the current accessed route and generate the url from it.

Usually, you'll want to use the canonical() function directly within your main layout.

Seo Metadata

Use the seo_metadata(your_entity) twig function in your templates.

SeoBundle will automatically find the most pertinent fields in your entity to deduct title and description.

Again, seo_metadata() can be used without passing it any entity.

Administrating metadata

In order to administrate Seo Metadata, you'll need again to tune-up your entity.

Make your entity implement the HasSeoMetadataInterface and use the SeoMetadataTrait

If the configuration umanit_seo.metadata.form_type.add_seo_metadata_type is not disabled, all form which handles your entity as data will automatically have a new SeoMetadataType form type.

This will add a subform with two fields, title and description.

_Note: The form type class can be customized with umanit_seo.metadata.form_type.class_fqcn._

Schema.org implementation

To generate valid schema.org json microdata, SeoBundle must be able to process the given entity. To do so, the umanit_seo.schemable service uses handlers to process the entity.

A handler is a service which implements Umanit\SeoBundle\Handler\Schemable\SchemableHandlerInterface. A supports method indicated if the service can handle the given entity and a process method do the job by returning a Spatie\SchemaOrg\BaseType object.

The Spatie\SchemaOrg\BaseType object is provided by the library spatie/schema-org.

You must implement the interface Umanit\SeoBundle\Model\SchemableModelInterface on your entity and create a handler to process it.

Next, add the twig function seo_schema_org() at the bottom of your layout.

The function will format and display the json schema of the current entity as you defined it.

Breadcrumb

You can easily generate your breadcrumb in 3 different formats; Microdata, RDFa or JSON-LD as described by the specification. To do so, the umanit_seo.breadcrumbable service uses handlers to process the entity.

A handler is a service which implements Umanit\SeoBundle\Handler\Breadcrumbable\BreadcrumbableHandlerInterface. A supports method indicated if the service can handle the given entity and a process method do the job by returning a Umanit\SeoBundle\Model\Breadcrumb object.

The Umanit\SeoBundle\Model\Breadcrumb obect has a format attribute, which is one of the previously mentionned and a items attributes which is an array of Umanit\SeoBundle\Model\BreadcrumbItem. Each BreadcrumbItem has a label attribute and an optionnal url attribute.

You must implement the interface Umanit\SeoBundle\Model\BreadcrumbableModelInterface on your entity and create a handler to process it.

_Note: If the processed entity implements the RoutableModelInterface, you can omit the url attribute to let the service umanit_seo.routable generate it for you._

You can now use the twig function seo_breadcrumb() like the following examples:

Enabling 301 redirects

In order to enable URL history and 301 redirects on an entity, ensure the configuration umanit_seo.url_historization.enabled is active (yes by default) then implement the interface Umanit\SeoBundle\Model\HistorizableUrlModelInterface and use the trait Umanit\SeoBundle\Doctrine\Model\HistorizableUrlTrait.

Twig functions reference

Protips


All versions of seo-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
spatie/schema-org Version ^3.2
ramsey/uuid Version ^4.1
symfony/twig-bundle Version ^6.4|^7.0
twig/extra-bundle Version ^3.0
twig/twig Version ^3.0
doctrine/doctrine-bundle Version ^2.0
doctrine/doctrine-migrations-bundle Version ^3.0
doctrine/orm Version ^2.7
symfony/form Version ^6.4|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package umanit/seo-bundle contains the following files

Loading the files please wait ....