Download the PHP package cba85/php-seo-tag without Composer
On this page you can find all versions of the php package cba85/php-seo-tag. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cba85/php-seo-tag
More information about cba85/php-seo-tag
Files in cba85/php-seo-tag
Package php-seo-tag
Short Description A PHP package to add metadata tags for search engines and social networks to better index and display your site's content.
License MIT
Homepage https://github.com/cba85/php-seo-tag/
Informations about the package php-seo-tag
PHP SEO tag
A PHP package inspired by jekyll-seo-tag to add metadata tags for search engines and social networks to better index and display your site's content.
What it does
PHP SEO Tag adds the following meta tags to your site:
- Page title
- Page description
- Canonical URL
- Next and previous URLs on paginated pages
- JSON-LD Site and post metadata for richer indexing
- Open Graph title, description, site title, and URL (for Facebook, LinkedIn, etc.)
- Twitter Summary Card metadata
PHP SEO tag isn't designed to accommodate every possible use case. It should work for most site out of the box and without a laundry list of configuration options that serve only to confuse most users.
Installation
You can install the package via composer:
Usage
The package will return the HTML metatags depending of your parameters.
You then just have to display the $seo
variable.
You'll find an example in the example folder.
Multiples array
You can pass as parameters how many arrays containing your tags as you want. The package will merge them. It could be useful if you want to separate general tags of your website and specific tags of your page.
You'll find an example of this in the example folder.
Tags
The SEO tag will respect any of the following if included the $tags
array (and simply not include them if they're not defined):
-
site_title
- Your site's title (e.g., My awesome website) -
page_title
- Your page's title (e.g., About) -
description
- A short description (e.g., A blog dedicated to reviewing cat gifs) -
url
- The full URL to your site. -
date
- The date your page was published.date_modified
anddate_published
- You can manually specify the date modified and date published.
This field will take first priority for the dateModified JSON-LD output. This is useful when the file timestamp does not match the true time that the content was modified.
-
author
- Author name -
twitter
- The site's Twitter handle. -
facebook
- The following properties are available:app_id
- a Facebook app ID for Facebook insightspublisher
- a Facebook page URL or ID of the publishing entityadmins
- a Facebook user ID for domain insights linked to a personal account
You'll want to describe one or more like so:
-
image
- URL to a site-wide logo (e.g.,/assets/img/your-company-logo.png
)For most users, setting
$tags['image'] => "path-to-image"
on a per-page basis should be enough. If you need more control over how images are represented, theimage
property can also be an object, with the following options:path
- The relative path to the image. Same as$tags['image'] => "path-to-image"
height
- The height of the Open Graph (og:image
) imagewidth
- The width of the Open Graph (og:image
) image
You can use any of the above, optional properties, like so:
-
social
- For specifying social profiles. -
google_site_verification
for verifying ownership via Google webmaster tools Alternatively, verify ownership with several services at once using the following format: -
lang
- The locale these tags are marked up in. Of the formatlanguage_TERRITORY
. Default isen_US
. -
type
- The type of things that the page represents. This must be a Schema.org type, and will probably usually be something likeBlogPosting
,NewsArticle
,Person
,Organization
, etc. -
generator
- The generator of your website. -
canonical_url
- You can set custom Canonical URL for a page by specifying canonical_url option. If no canonical_url option was specified, then uses page url for generating canonical_url. previous_page
andnext_page
- Next and previous URLs on paginated pages.
Testing
No unit test yet.
Credits
License
Please see License File for more information.