Download the PHP package meestorhok/seo without Composer
On this page you can find all versions of the php package meestorhok/seo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download meestorhok/seo
More information about meestorhok/seo
Files in meestorhok/seo
Package seo
Short Description Ultimate SEO creation for Laravel 5
License MIT
Homepage https://github.com/Pyncil/SEO
Informations about the package seo
Pyncil SEO for Laravel 5
Pyncil SEO is the ultimate SEO generator for Laravel 5
Install
Via Composer
Update the Laravel Framework
Add the following provider to config/app.php
Usage
When creating a new view in your controller, you can set the SEO data:
Note: Don't forget to add use SEO;
to include the class.
Then, in your view, you can either get all of the tags:
Or get each tag by hand:
See the available functions for a list of available getters and setters.
Functions
Setters:
Function | Description |
---|---|
setTitle($title) |
Required: Sets the page title. |
setSubtitle($subtitle) |
Optional subtitle, separated by the separator. |
setTitleSeparator($separator) |
Separates title and subtitle - defaults to ' – ' |
setDescription($description) |
Required: Sets the page description. |
setKeywords($keywords) |
Sets the keywords - overrides existing keywords. |
addKeyword($keyword) |
Add a keyword to existing keyword list. |
addKeywords($keywords) |
Add list of keywords to existing list. (takes array or comma delimeted string) |
removeKeyword($keyword) |
Remove a keyword from the existing list. |
setCanonical($url = URL::current()) |
Sets canonical URL. If no parameter is set, defaults to URL::current() |
setRobots($robots = 'index,follow') |
Sets the robots. If no parameter is set, defaults to 'index,follow' |
setViewport($viewport = 'width=device-width, initial-scale=1') |
Sets the viewport for mobile sites. If no parameter is set, defaults to 'width=device-width, initial-scale=1' |
setPrev($url) |
Sets the previous URL, used for pagination and sequential articles. |
setNext($url) |
Sets the next URL, used for pagination and sequential articles. |
addMeta($meta, $content = null, $name = 'name') |
Add custom meta tag. See Custom Tags for details. |
removeMeta($meta) |
Remove custom tag by name. |
Getters:
All of the following functions return html.
Function | Description |
---|---|
get($minify = true) |
Gets all set SEO tags. Set $minify to false to recieve HTML on multiple lines. |
getTitle() |
Gets the page title. |
getDescription() |
Gets the page description. |
getKeywords() |
Gets the keywords. |
getCanonical() |
Gets the canonical URL. |
getRobots() |
Gets the robots. |
getViewport() |
Gets the viewport. If no parameter is set, defaults to 'width=device-width, initial-scale=1' |
getPrev() |
Gets the previous URL, used for pagination and sequential articles. |
getNext() |
Gets the next URL, used for pagination and sequential articles. |
getMeta() |
Gets all of the custom tags. |
Custom Tags
Adding custom tags is a cinch! Simply declare the name and content like so:
Function | Output |
---|---|
SEO::addMeta('author', 'Billy Bob') |
<meta name="author" content="Billy Bob"> |
SEO::addMeta('refresh', 300, 'http-equiv') |
<meta http-equiv="refresh" content="300"> |
SEO::addMeta('UTF-8', null, 'charset') |
<meta charset="UTF-8"> |
SEO::addMeta(['author' => 'Billy', 'copyright' => 'PotatoFace']) |
<meta name="author" content="Billy"> <meta name="copyright" content="PotatoFace"> |
Favicons
Many different browsers, computers, and operating systems like to retrieve a page's favicon in their own, creative ways. Stupid, I know. But, nevertheless, we must dance like the monkeys we are. So instead of creating 50 different favicons and link tags, just head on over to the Real Favicon Generator and download all of your new favicons.
Then, put them all in the folder of your choice.
DO NOT RENAME FILES
Once you do that, you can declare that you want favicons by calling:
Note: the url you pass must be relative to the public
directory.
then we can get your link tags dynamically like this:
And that's it!
The generator will only generate tags corresponding with existing files. If you don't want the tag, don't include the file.
Note: other items CAN exist in the icons folder. It is reccommended to put the icons in the /public
directory.
Advanced Setup
Let's say you want to customize the icon sizes on Android or iPhone. Or maybe the tile color in Windows 8 or 10. The following functions allow you to make those custom changes:
These sizes each take an array variable. Each string in the array must be in format "144x144" and corresponds with a file by that size.
Funcion | Description |
---|---|
setSizes($sizes) |
Sets general 'favicon-' sizes |
setAppleSizes($sizes) |
Sizes for 'apple-touch-' icons |
setAndroidSizes($sizes) |
Sizes for 'android-chrome-' icons |
To set custom colors, use setColors($colors)
. It takes an array of colors in this format:
those three color names are the only colors you may set. Colors must be in hex and none of them are required.
Credits
- Jake Mitchell
- All Contributors
License
The MIT License (MIT). Please see License File for more information.