Download the PHP package / without Composer

On this page you can find all versions of the php package /. 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?
/
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package

Packagist Version Run Tests - Current StyleCI Status License

Laravel Meta Tags

Easily render meta tags within your Laravel application, using a fluent API

Features

Requirements

Legacy Support / Upgrading

For PHP <8.0 and Laravel <8.12 / support, use package version ^1.7.7

If upgrading from ^1.0, see UPGRADING for details.

Installation

The package will automatically register itself.

Optionally publish the configuration file by running:

Documentation

This package aims to make adding common meta tags to your Laravel application a breeze.

Usage

Within a controller:

To output metadata add the following within a Blade layout file:

Optionally, the Meta facade can be used as an alternative to meta() helper, generating the same output:

Conditionally Setting Tags

The when() method can be used to conditionally set tags. A boolean condition (indicating if the closure should be executed) and a closure. The closure parameter is full instance of the meta class, meaning all methods are callable.

The when() is fluent and can be called multiple times:

Blade Directives

Blade directives are available, as an alternative to using PHP function within templates.

To render all metadata:

Render a specific meta tag by name:

Additional tag types

The package supports multiple tag types.

Property type tags

To create property type tags, append property: before the tag name.

Twitter card tags

To create twitter card tags, append twitter: before the tag name.

Open Graph tags

To create Open Graph (or Facebook) tags, append og: before the tag name:

Other tag types

To create other tag types, use the raw() method:

Default tags

It may be desirable to render static meta tags application wide. Optionally define common tags within f9web-laravel-meta.defaults.

For example, defining the below defaults

will render the following on every page:

Helper methods

get()

Fetch a specific tag value by name.

null is returned for none existent tags.

render()

Render all defined tags. render() is called when rendering tags within Blade files.

The below calls are identical.

Passing a tag title to render() will render that tag.

fromArray()

Generate multiple tags from an array of tags.

setRawTags()

Generate multiple raw tags from an array.

tags()

Fetch all tags as an array.

purge()

Remove all previously set tags.

forget()

Remove a previously set tag by title.

noIndex()

Generate the necessary tags to exclude the url from search engines.

favIcon()

Generate the necessary tags for a basic favicon. The favicon path can be specified within the f9web-laravel-meta.favicon-path configuration value.

Dynamic Calls

For improved readability, it is possible to make dynamic method calls. The below codes blocks would render identical HTML:

Macroable Support

The package implements Laravel's Macroable trait, meaning additional methods can be added the main Meta service class at run time. For example, [Laravel's collection class is macroable](For furtherinformatioin see the following samples ).

The noIndex and favIcon helpers are defined as macros within the package service provider.

Sample macro to set arbitrary defaults tags for SEO:

To call the newly defined macro:

Macros can also accept arguments.

To allow for fluent method calls ensure the macro returns an instance of the class.

Special tags

Meta title

The package ensures a meta tag is always present. Omitting a title will force the package to guess one based upon the current named route or uri.

The set the preferred method, edit the f9web-laravel-meta.title-guessor.method configuration value.

uri method sample
route method sample

This behaviour can be disabled via editing the f9web-laravel-meta.title-guessor.enabled configuration value.

This automatic resolution is useful in large applications, where it would be otherwise cumbersome to set metadata for every controller method.

Appending text to the meta title

Typically, common data such as the company name is appended to meta titles.

The f9web-laravel-meta.meta-title-append configuration value can be set to append the given string automatically to every meta title.

To disable this behaviour set f9web-laravel-meta.meta-title-append to null.

Limiting the meta title length

For SEO reasons, the meta title length should be restricted. This package, by default, limits the title to 60 characters.

To change this behaviour update the configuration value of f9web-laravel-meta.title-limit. Set to null to stop limiting.

Meta description

For SEO reasons, the meta description should typically remain less than ~160 characters. This package, by default, does not limit the length.

To change the limit adjust the configuration value f9web-laravel-meta.description-limit. Set to null to stop limiting.

Canonical

It is important to set a sensible canonical. Optionally, the package can automatically replace user defined strings when generating a canonical.

Due to incorrect setup some Laravel installations allow public and/or index.php within the url.

For instance, /users/create, /public/users/create and /public/index.php/users/create would both be visitable, crawlable and ultimately indexable urls.

By editing the array of removable url strings within f9web-laravel-meta.removable-uri-segments, this behaviour can be controlled.

The package will strip public and index.php from canonical urls automatically, as a default.

Contribution

Any ideas are welcome. Feel free to submit any issues or pull requests.

Testing

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of with dependencies

PHP Build Version
Package Version
No informations.
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 / contains the following files

Loading the files please wait ....