Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the package #51

Merged
merged 1 commit into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: php

sudo: false

php:
- 7.2
- 7.3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/SEO-Helper/re
* Easy setup & configuration.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.0` to `6.0` are supported.
* Laravel `5.x | 6.x` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand Down
2 changes: 1 addition & 1 deletion _docs/0-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SEO Helper is a package that provides tools and helpers for SEO (Search Engine O
* Easy setup & configuration.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.0` to `6.0` are supported.
* Laravel `5.x | 6.x` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand Down
22 changes: 11 additions & 11 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
| ![SEO-Helper v1.5.x][seo_helper_1_5_x] | ![Laravel v5.6][laravel_5_6] |
| ![SEO-Helper v1.6.x][seo_helper_1_6_x] | ![Laravel v5.7][laravel_5_7] |
| ![SEO-Helper v1.7.x][seo_helper_1_7_x] | ![Laravel v5.8][laravel_5_8] |
| ![SEO-Helper v2.0.x][seo_helper_2_0_x] | ![Laravel v6.0][laravel_6_0] |
| ![SEO-Helper v2.x][seo_helper_2_x] | ![Laravel v6.x][laravel_6_x] |

[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
Expand All @@ -30,16 +30,16 @@
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8"
[laravel_6_0]: https://img.shields.io/badge/v6.0-supported-brightgreen.svg?style=flat-square "Laravel v6.0"

[seo_helper_1_1_x]: https://img.shields.io/badge/version-1.1.*-blue.svg?style=flat-square "SEO-Helper v1.1.*"
[seo_helper_1_2_x]: https://img.shields.io/badge/version-1.2.*-blue.svg?style=flat-square "SEO-Helper v1.2.*"
[seo_helper_1_3_x]: https://img.shields.io/badge/version-1.3.*-blue.svg?style=flat-square "SEO-Helper v1.3.*"
[seo_helper_1_4_x]: https://img.shields.io/badge/version-1.4.*-blue.svg?style=flat-square "SEO-Helper v1.4.*"
[seo_helper_1_5_x]: https://img.shields.io/badge/version-1.5.*-blue.svg?style=flat-square "SEO-Helper v1.5.*"
[seo_helper_1_6_x]: https://img.shields.io/badge/version-1.6.*-blue.svg?style=flat-square "SEO-Helper v1.6.*"
[seo_helper_1_7_x]: https://img.shields.io/badge/version-1.7.*-blue.svg?style=flat-square "SEO-Helper v1.7.*"
[seo_helper_2_0_x]: https://img.shields.io/badge/version-2.0.*-blue.svg?style=flat-square "SEO-Helper v2.0.*"
[laravel_6_x]: https://img.shields.io/badge/v6.x-supported-brightgreen.svg?style=flat-square "Laravel v6.x"

[seo_helper_1_1_x]: https://img.shields.io/badge/version-1.1.x-blue.svg?style=flat-square "SEO-Helper v1.1.x"
[seo_helper_1_2_x]: https://img.shields.io/badge/version-1.2.x-blue.svg?style=flat-square "SEO-Helper v1.2.x"
[seo_helper_1_3_x]: https://img.shields.io/badge/version-1.3.x-blue.svg?style=flat-square "SEO-Helper v1.3.x"
[seo_helper_1_4_x]: https://img.shields.io/badge/version-1.4.x-blue.svg?style=flat-square "SEO-Helper v1.4.x"
[seo_helper_1_5_x]: https://img.shields.io/badge/version-1.5.x-blue.svg?style=flat-square "SEO-Helper v1.5.x"
[seo_helper_1_6_x]: https://img.shields.io/badge/version-1.6.x-blue.svg?style=flat-square "SEO-Helper v1.6.x"
[seo_helper_1_7_x]: https://img.shields.io/badge/version-1.7.x-blue.svg?style=flat-square "SEO-Helper v1.7.x"
[seo_helper_2_x]: https://img.shields.io/badge/version-2.x-blue.svg?style=flat-square "SEO-Helper v2.x"

## Composer

Expand Down
114 changes: 113 additions & 1 deletion _docs/2-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,116 @@
4. [API](4-API.md)
5. [Extras](5-Extras.md)

> Coming Soon ...

```php
<?php

return [

/* -----------------------------------------------------------------
| Title
| -----------------------------------------------------------------
*/

'title' => [
'default' => 'Default Title',
'site-name' => config('app.name', 'My Application'),
'separator' => '-',
'first' => true,
'max' => 55,
],

/* -----------------------------------------------------------------
| Description
| -----------------------------------------------------------------
*/

'description' => [
'default' => 'Default description',
'max' => 155,
],

/* -----------------------------------------------------------------
| Keywords
| -----------------------------------------------------------------
*/

'keywords' => [
'default' => [
//
],
],

/* -----------------------------------------------------------------
| Miscellaneous
| -----------------------------------------------------------------
*/

'misc' => [
'canonical' => true,
'robots' => config('app.env') !== 'production', // Tell robots not to index the content if it's not on production
'default' => [
'viewport' => 'width=device-width, initial-scale=1', // Responsive design thing
'author' => '', // https://plus.google.com/[YOUR PERSONAL G+ PROFILE HERE]
'publisher' => '', // https://plus.google.com/[YOUR PERSONAL G+ PROFILE HERE]
],
],

/* -----------------------------------------------------------------
| Webmaster Tools
| -----------------------------------------------------------------
*/

'webmasters' => [
'google' => '',
'bing' => '',
'alexa' => '',
'pinterest' => '',
'yandex' => '',
],

/* -----------------------------------------------------------------
| Open Graph
| -----------------------------------------------------------------
*/

'open-graph' => [
'enabled' => true,
'prefix' => 'og:',
'type' => 'website',
'title' => 'Default Open Graph title',
'description' => 'Default Open Graph description',
'site-name' => '',
'properties' => [
//
],
],

/* -----------------------------------------------------------------
| Twitter
| -----------------------------------------------------------------
| Supported card types : 'app', 'gallery', 'photo', 'player', 'product', 'summary', 'summary_large_image'.
*/

'twitter' => [
'enabled' => true,
'prefix' => 'twitter:',
'card' => 'summary',
'site' => 'Username',
'title' => 'Default Twitter Card title',
'metas' => [
//
],
],

/* -----------------------------------------------------------------
| Analytics
| -----------------------------------------------------------------
*/

'analytics' => [
'google' => '', // UA-XXXXXXXX-X
],

];
```
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"license": "MIT",
"require": {
"php": ">=7.2.0",
"arcanedev/php-html": "~3.0",
"arcanedev/support": "~5.0.0"
"arcanedev/php-html": "^3.0",
"arcanedev/support": "^5.0"
},
"require-dev": {
"ext-dom": "*",
"orchestra/testbench": "~4.0.0",
"phpunit/phpcov": "~6.0",
"phpunit/phpunit": "~8.0"
"orchestra/testbench": "^4.0",
"phpunit/phpcov": "^6.0",
"phpunit/phpunit": "^8.0"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*
* @return \Arcanedev\SeoHelper\Contracts\SeoHelper
*/
function seo_helper() {
function seo_helper(): SeoHelper
{
return app(SeoHelper::class);
}
}
8 changes: 4 additions & 4 deletions src/Entities/Description.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Description implements DescriptionContract
*
* @var string
*/
protected $name = 'description';
protected $name = 'description';

/**
* The meta content.
Expand All @@ -45,7 +45,7 @@ class Description implements DescriptionContract
*
* @var int
*/
protected $max = 155;
protected $max = 155;

/* -----------------------------------------------------------------
| Constructor
Expand Down Expand Up @@ -182,7 +182,7 @@ public function __toString()
*
* @return bool
*/
private function hasContent()
private function hasContent(): bool
{
return ! empty($this->get());
}
Expand All @@ -194,7 +194,7 @@ private function hasContent()
*
* @throws \Arcanedev\SeoHelper\Exceptions\InvalidArgumentException
*/
private function checkMax($max)
private function checkMax($max): void
{
if ( ! is_int($max)) {
throw new InvalidArgumentException(
Expand Down
4 changes: 2 additions & 2 deletions src/Entities/Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function __toString()
*
* @return bool
*/
private function hasContent()
private function hasContent(): bool
{
return ! empty($this->getContent());
}
Expand All @@ -200,7 +200,7 @@ private function hasContent()
*
* @return string
*/
private function clean($value)
private function clean(string $value): string
{
return trim(strip_tags($value));
}
Expand Down
10 changes: 5 additions & 5 deletions src/Entities/MiscTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function __toString()
*
* @return bool
*/
private function hasUrl()
private function hasUrl(): bool
{
return ! empty($this->getUrl());
}
Expand All @@ -217,7 +217,7 @@ private function hasUrl()
*
* @return bool
*/
private function isCanonicalEnabled()
private function isCanonicalEnabled(): bool
{
return (bool) $this->getConfig('canonical', false);
}
Expand All @@ -227,7 +227,7 @@ private function isCanonicalEnabled()
*
* @return bool
*/
private function isRobotsEnabled()
private function isRobotsEnabled(): bool
{
return (bool) $this->getConfig('robots', false);
}
Expand All @@ -242,7 +242,7 @@ private function isRobotsEnabled()
*
* @return \Arcanedev\SeoHelper\Entities\MiscTags
*/
private function addRobotsMeta()
private function addRobotsMeta(): self
{
if ($this->isRobotsEnabled())
$this->add('robots', 'noindex, nofollow');
Expand All @@ -255,7 +255,7 @@ private function addRobotsMeta()
*
* @return \Arcanedev\SeoHelper\Entities\MiscTags
*/
private function addCanonical()
private function addCanonical(): self
{
if ($this->isCanonicalEnabled() && $this->hasUrl())
$this->add('canonical', $this->currentUrl);
Expand Down
12 changes: 6 additions & 6 deletions src/Entities/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public function __toString()
*
* @return bool
*/
private function hasSiteName()
private function hasSiteName(): bool
{
return ! empty($this->getSiteName()) && $this->siteNameVisibility;
}
Expand All @@ -365,7 +365,7 @@ private function hasSiteName()
*
* @throws \Arcanedev\SeoHelper\Exceptions\InvalidArgumentException
*/
private function checkTitle(&$title)
private function checkTitle(&$title): void
{
if ( ! is_string($title)) {
$type = gettype($title);
Expand All @@ -387,7 +387,7 @@ private function checkTitle(&$title)
*
* @throws \Arcanedev\SeoHelper\Exceptions\InvalidArgumentException
*/
private function checkMax($max)
private function checkMax($max): void
{
if ( ! is_int($max)) {
throw new InvalidArgumentException('The title maximum length must be integer.');
Expand All @@ -410,7 +410,7 @@ private function checkMax($max)
*
* @return string
*/
private function renderTitleFirst($separator)
private function renderTitleFirst(string $separator): string
{
$output = [];
$output[] = $this->getTitleOnly();
Expand All @@ -430,7 +430,7 @@ private function renderTitleFirst($separator)
*
* @return string
*/
private function renderTitleLast($separator)
private function renderTitleLast(string $separator): string
{
$output = [];

Expand All @@ -451,7 +451,7 @@ private function renderTitleLast($separator)
*
* @return string
*/
private function prepareTitleOutput($output)
private function prepareTitleOutput(string $output): string
{
return htmlspecialchars(
Str::limit(strip_tags($output), $this->getMax()), ENT_QUOTES, 'UTF-8', false
Expand Down
6 changes: 3 additions & 3 deletions src/Entities/Twitter/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function __toString()
*
* @throws \Arcanedev\SeoHelper\Exceptions\InvalidTwitterCardException
*/
private function checkType(&$type)
private function checkType(&$type): void
{
if ( ! is_string($type)) {
throw new InvalidTwitterCardException(
Expand All @@ -309,7 +309,7 @@ private function checkType(&$type)
*
* @param string $site
*/
private function checkSite(&$site)
private function checkSite(string &$site): void
{
$site = $this->prepareUsername($site);
}
Expand All @@ -326,7 +326,7 @@ private function checkSite(&$site)
*
* @return string
*/
private function prepareUsername($username)
private function prepareUsername(string $username): string
{
return Str::startsWith($username, '@')
? $username :
Expand Down
Loading