Download the PHP package butschster/meta-tags without Composer

On this page you can find all versions of the php package butschster/meta-tags. 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 meta-tags

meta-tags

The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project

Laravel SEO Meta Tags offers a sophisticated solution for Laravel applications, allowing developers to seamlessly manage header meta tags, CSS, JavaScript, and other relevant tags. Its primary objective is to simplify the process of managing search engine optimization (SEO) tags within your application.

Moreover, its versatile API makes it compatible with frameworks like Inertiajs, VueJS and other JavaScript frameworks.

For any questions or further assistance, please join our official telegram group

Contributing

We enthusiastically invite you to contribute to the package! Whether you've uncovered a bug, have innovative feature suggestions, or wish to contribute in any other capacity, we warmly welcome your participation. Simply open an issue or submit a pull request on our GitHub repository to get started.

Remember, every great developer was once a beginner. Contributing to open source projects is a step in your journey to becoming a better developer. So, don't hesitate to jump in and start contributing!

We appreciate any contributions to help make the package better!

Support me on Patreon

Build Status Latest Stable Version Total Downloads License

Features

Requirements

Installation and Configuration

  1. Install the package: Use the following command to install the Meta Tags package in your awesome application.

  2. Register the Service Provider: After installing the package, you must register its service provider.

You can do it using the following artisan command:

This command will activate the App\Providers\MetaTagsServiceProvider and publish the configuration at config/meta_tags.php. Within this configuration file, you can set default titles, keywords, descriptions, and other meta tags which will be automatically inserted into your HTML.

  1. Verification: Ensure that App\Providers\MetaTagsServiceProvider has been added to the providers array in your config/app.php configuration file. If it hasn't, you'll need to add it manually. Remember, if your application isn't using the App namespace, update the provider class name accordingly.

And that's all! Your Laravel project is now equipped to handle SEO meta tags with ease.

Usage

Controller

You can use either Facade \Butschster\Head\Facades\Meta or \Butschster\Head\Contracts\MetaTags\MetaInterface in your controller

View

To integrate meta tags into your HTML, simply insert {!! Meta::toHtml() !!} wherever required.

Note You have two options to insert meta tags: {!! Meta::toHtml() !!} or the Blade directive @meta_tags.

Here's an example of how you can use it in your view:

Placements

The package provides flexibility to insert meta tags beyond the header. You can define specific placements in your templates.

Packages

To avoid code repetition and improve code organization, you can group tags, assets, etc., into named packages. This allows for streamlined inclusion of sets of meta tags or assets where needed.

To create a new package:

To define packages, you can use the PackageManager::create method:

Using Packages in Controllers

When specific packages are required within a controller, you can include them by referencing the package name:

Setting Global Packages

For packages that should be included on every page, you can define them in the config/meta_tags.php:

And there you have it! With these steps, handling and organizing meta tags and assets becomes a breeze.

Note All methods available in the Meta class can also be utilized alongside these package functions.

API

Meta

\Butschster\Head\MetaTags\Meta

Methods

Set the main part of meta title

Prepend title part to main title

Set the title separator

By default it gets from config

Set the description

Set the keywords

Set the robots

Set the content type

Set the viewport

Add webmaster tags You can add multiple tags

Set the prev href

Set the next href

Set the canonical link

Set canonical link, prev and next from paginator object

Add a hreflang link

Set the character encoding for the HTML document

Set the favicon

Add a custom link tag

Add a link to a css file

Add a link to a script file

Register a custom tag Our package has a lot of ways of extending. One of them is creating new tags. You are able to create a new class and share it with friends or with the laravel community. You can also create a new pull request if you think that your awesome tag is really useful.

Register tags from TagsCollection

Get a tag by name

Remove a tag by name

Add a meta tag

Add the CSRF-token tag

Remove all tags

Include required packages

Register a new package and register all tags from this package

Replace package with the same name When you replace package with a new one, old tags will be removed

Remove package by name

Get package by name

Using meta interfaces

A package has different interfaces which help you set meta tags from your objects

Seo tags

Meta extending

Meta object contains Macroable trait and you can extend it!

For example

A little bit infirmation about macroable trait https://unnikked.ga/understanding-the-laravel-macroable-trait-dab051f09172

Meta tags placements

By default, tags place to head placement. You can specify your own placement and use their all available methods.

Package

A package object has the same methods as Meta object. You can use it for extending and creating custom tags sets.

\Butschster\Head\Packages\Package

Create a new package and register it in PackageManager

Get the name of the package

Add a link to a css file

Add a link to a script file

Available packages


OpenGraphPackage

Butschster\Head\Packages\Entities\OpenGraphPackage

You can use this package for managing OpenGraph meta tags

setType Set the type of your object, e.g., "video.movie".

setTitle Set the title of your object as it should appear within the graph, e.g., "The Rock".

setDescription Set the description

setSiteName Set the site name

setUrl Set the canonical URL of your object that will be used as its permanent ID in the graph.

setLocale Set the locale these tags are marked up in. Of the format language_TERRITORY

addAlternateLocale

addImage Add an image URL which should represent your object within the graph.

addVideo Add an image URL which should represent your object within the graph.

TwitterCardPackage

Butschster\Head\Packages\Entities\TwitterCardPackage

You can use this package for managing Twitter card meta tags

setType Set the type of the card: summary, summary_large_image, player, app

setSite Set the @username for the website used in the card footer.

setCreator Set the @username for the content creator / author.

setTitle Set the title

setDescription Set the description

setImage Set an image for cards that are of type summary or summary_large_image

setVideo Set a video to cards that are of type player

addMeta Set a custom meta tag

PackageManager API

Package manager provide a store for your packages or presets. You can get them by name.

Create a new package

Register a new package

Get all registered packages

Get registered package by name

Dependencies

A package can have dependencies.

Helper classes

Tag


\Butschster\Head\MetaTags\Entities\Tag

Create a new tag

Set the placement

Get the placement

Set visibility condition

Title


\Butschster\Head\MetaTags\Entities\Title

This class is responsible for title generation

Set the default part of the title

Prepend a new part of title

Change default title parts separator

Specify max length (default length is 255)

Description


\Butschster\Head\MetaTags\Entities\Description

Script


\Butschster\Head\MetaTags\Entities\Script

This class is responsible for script links generation

Style


\Butschster\Head\MetaTags\Entities\Style

This class is responsible for css links generation

Favicon


\Butschster\Head\MetaTags\Entities\Favicon

This class is responsible for favicon link generation

Comment


\Butschster\Head\MetaTags\Entities\Comment

This class is a wrapper for tags, that allows to add comments to your tags

Conditional comment


\Butschster\Head\MetaTags\Entities\ConditionalComment

This class is a wrapper for tags, that allows to add conditional comments to your tags

Google Analytics


Has header placement!

Will return

Google TagManager


Has header placement!

Will return

Yandex Metrika


Has footer placement!

Will return

Change clickmap setting

Change webvisor setting

Change trackLinks setting

Change accurateTrackBounce setting

Change trackHash setting

Change eCommerce setting

Use alternate CDN

Disable noscript tag

Javascript variables


Will return

You can change namespace

Will return

Use cases

Multiple favicons

You can use your own package for that.

At first create your package in the MetaTagsServiceProvider App\Providers\MetaTagsServiceProvider

And then append this package into packages section in config/meta_tags.php:

And the every page you will see in the head seaction something like that:

Extending

If you want to extend Meta class you can do it in the App\Providers\MetaTagsServiceProvider. Just override registerMeta method.

Using with inertiajs or vue-meta

You can easily convert Meta object to array ant the use values in your Js project

Example for inertiaJs


All versions of meta-tags with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
php Version >=8.0
illuminate/config Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/contracts Version ^9.0|^10.0|^11.0
illuminate/console Version ^9.0|^10.0|^11.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 butschster/meta-tags contains the following files

Loading the files please wait ....