Skip to content

Commit c7f9c08

Browse files
committed
initial commit
0 parents  commit c7f9c08

36 files changed

+2172
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Please prefix your issue with one of the following: **[BUG]** **[PROPOSAL]** **[QUESTION]**.
2+
3+
**In raising this issue, I confirm the following (please check boxes):**
4+
5+
- [ ] I have read and understood the [contributors guide]().
6+
- [ ] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
7+
- [ ] I have checked that the bug-fix I am reporting can be replicated.
8+
9+
---
10+
11+
### Description of the problem
12+
...
13+
14+
### Steps to reproduce
15+
...

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**.
2+
3+
**In raising this pull request, I confirm the following (please check boxes):**
4+
5+
- [ ] I have read and understood the [contributors guide]().
6+
- [ ] I have checked that another pull request for this purpose does not exist.
7+
- [ ] I have considered, and confirmed that this submission will be valuable to others.
8+
- [ ] I have added tests to prove that the code in this PR works.
9+
10+
---
11+
12+
### Description
13+
...

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build
2+
composer.lock
3+
docs
4+
vendor
5+
tests/Integration/temp

.scrutinizer.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
filter:
2+
excluded_paths: [tests/*]
3+
4+
checks:
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
19+
20+
tools:
21+
sensiolabs_security_checker: true

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: php
2+
3+
php:
4+
- 7.0
5+
- 7.1
6+
7+
env:
8+
matrix:
9+
- COMPOSER_FLAGS=""
10+
11+
before_script:
12+
- travis_retry composer self-update
13+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
14+
15+
script:
16+
- phpunit --coverage-text --coverage-clover=coverage.clover
17+
18+
after_script:
19+
- wget https://scrutinizer-ci.com/ocular.phar
20+
- php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All Notable changes to `laravel-google-structured-data-testing-tool` will be documented in this file
4+
5+
## 1.0.0 - 2016-11-01
6+
7+
- Initial release

CONDUCT.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct.
15+
16+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community in a direct capacity. Personal views, beliefs and values of individuals do not necessarily reflect those of the organisation or affiliated individuals and organisations.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
Please read and understand the contribution guide before creating an issue or pull request.
6+
7+
## Etiquette
8+
9+
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10+
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11+
extremely unfair for them to suffer abuse or anger for their hard work.
12+
13+
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14+
world that developers are civilized and selfless people.
15+
16+
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18+
19+
## Viability
20+
21+
When requesting or submitting new features, first consider whether it might be useful to others. Open
22+
source projects are used by many developers, who may have entirely different needs to your own. Think about
23+
whether or not your feature is likely to be used by other users of the project.
24+
25+
## Procedure
26+
27+
Before filing an issue:
28+
29+
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30+
- Check to make sure your feature suggestion isn't already present within the project.
31+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32+
- Check the pull requests tab to ensure that the feature isn't already in progress.
33+
34+
Before submitting a pull request:
35+
36+
- Check the codebase to ensure that your feature doesn't already exist.
37+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38+
39+
## Requirements
40+
41+
If the project maintainer has any additional requirements, you will find them listed here.
42+
43+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
44+
45+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
46+
47+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48+
49+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
50+
51+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52+
53+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
54+
55+
**Happy coding**!

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2016 Padosoft (https://www.padosoft.com)
4+
5+
> Permission is hereby granted, free of charge, to any person obtaining a copy
6+
> of this software and associated documentation files (the "Software"), to deal
7+
> in the Software without restriction, including without limitation the rights
8+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
> copies of the Software, and to permit persons to whom the Software is
10+
> furnished to do so, subject to the following conditions:
11+
>
12+
> The above copyright notice and this permission notice shall be included in
13+
> all copies or substantial portions of the Software.
14+
>
15+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
> THE SOFTWARE.

README.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Laravel Package for testing Schema.org markup or other structured data formats with google structured data testing tool undocumented API.
2+
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/padosoft/laravel-google-structured-data-testing-tool.svg?style=flat-square)](https://packagist.org/packages/padosoft/laravel-google-structured-data-testing-tool)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
5+
[![Build Status](https://img.shields.io/travis/padosoft/laravel-google-structured-data-testing-tool/master.svg?style=flat-square)](https://travis-ci.org/padosoft/laravel-google-structured-data-testing-tool)
6+
[![Quality Score](https://img.shields.io/scrutinizer/g/padosoft/laravel-google-structured-data-testing-tool.svg?style=flat-square)](https://scrutinizer-ci.com/g/padosoft/laravel-google-structured-data-testing-tool)
7+
[![Total Downloads](https://img.shields.io/packagist/dt/padosoft/laravel-google-structured-data-testing-tool.svg?style=flat-square)](https://packagist.org/packages/padosoft/laravel-google-structured-data-testing-tool)
8+
[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/9482504c-ed2d-423f-94bb-1cf3a6babff0.svg?style=flat-square)](https://insight.sensiolabs.com/projects/9482504c-ed2d-423f-94bb-1cf3a6babff0)
9+
10+
This package provides a series of commands to automate and bulk check of Schema.org markup or other structured data formats with google structured data testing tool undocumented API that I found.
11+
Google already provides a good tool for testing markup data using the Search Console in Webmaster Tools.
12+
But how can I test markup data if you want to programmatically test your web site urls or a bulk set of urls?
13+
You can't do this with google wmt.
14+
This package try to resolve these problems.
15+
16+
## WARNING
17+
Note: This is an undocumented Google API. I found it when I interacted with Google’s Structured Data Testing Tool and Google Chrome debug console,
18+
thus there is no warranty that the API remains public or that the API changes make the package unusable.
19+
20+
##Requires
21+
22+
- php: >=7.0.0
23+
- illuminate/support: ^5.0
24+
- illuminate/http: ^5.0
25+
- padosoft/support": ^1.9
26+
27+
## Installation
28+
29+
You can install the package via composer:
30+
``` bash
31+
$ composer require padosoft/laravel-google-structured-data-testing-tool
32+
```
33+
You must install this service provider.
34+
35+
``` php
36+
// config/app.php
37+
'provider' => [
38+
...
39+
Padosoft\Laravel\Google\StructuredDataTestingTool\GoogleStructuredDataTestToolServiceProvider::class,
40+
...
41+
];
42+
```
43+
You don't need to register the command in app/Console/Kernel.php, because it provides by GoogleStructuredDataTestToolServiceProvider register() method.
44+
45+
You can publish the config file of this package with this command:
46+
``` bash
47+
php artisan vendor:publish --provider="Padosoft\Laravel\Google\StructuredDataTestingTool\GoogleStructuredDataTestToolServiceProvider"
48+
```
49+
The following config file will be published in `config/laravel-google-structured-data-testing-tool.php`
50+
``` php
51+
return array(
52+
'mailSubjectSuccess' => env(
53+
'STRUCTURED_DATA_TESTING_TOOL_SUBJECT_SUCCESS',
54+
'[google-structured-data-testing-tool]: Ok - markup data is ok.'
55+
),
56+
'mailSubjetcAlarm' => env(
57+
'STRUCTURED_DATA_TESTING_TOOL_SUBJECT_ALARM',
58+
'[google-structured-data-testing-tool]: Alarm - markup data error detected.'
59+
),
60+
'mailFrom' => env('STRUCTURED_DATA_TESTING_TOOL_MESSAGE_FROM', '[email protected]'),
61+
'mailFromName' => env('STRUCTURED_DATA_TESTING_TOOL_MESSAGE_FROM_NAME', 'Info Example'),
62+
'mailViewName' => env('STRUCTURED_DATA_TESTING_TOOL_MAIL_VIEW_NAME', 'laravel-google-structured-data-testing-tool::mail'),
63+
'logFilePath' => env('STRUCTURED_DATA_TESTING_TOOL_LOG_FILE_PATH', storage_path() . '/logs/laravel-google-structured-data-testing-tool.log')
64+
);
65+
```
66+
67+
In your app config folder you can copy from src/config/.env.example the settings for yours .env file used in laravel-google-structured-data-testing-tool.php.
68+
If you use mathiasgrimm/laravel-env-validator
69+
in src/config folder you'll find an example for validate the env settings.
70+
71+
72+
## USAGE
73+
74+
When the installation is done you can easily run command to print help:
75+
```bash
76+
php artisan google-markup:test https://www.padosoft.com
77+
```
78+
79+
The `google-markup:test` command check the structured data and schema.org markup in the given site https://www.padosoft.com
80+
81+
You can also pass the path of url txt (a file with one url per line) as an argument:
82+
`php google-markup:test /path/to/my/url.txt`
83+
so you can check multiple site/url (bulk) in one command!
84+
85+
By default, the command displays the result in console, but you can also
86+
send an html email by using the `--mail`option:
87+
```bash
88+
php google-markup:test https://www.padosoft.com [email protected]
89+
```
90+
### EXAMPLE:
91+
92+
Here is a basic example to check composer.lock into these dir:
93+
```bash
94+
php artisan google-markup:test https://www.padosoft.com
95+
```
96+
Here is an example to send output report to mail:
97+
```bash
98+
php artisan google-markup:test https://www.padosoft.com --mail=mymail@mydomain
99+
```
100+
Here is an example to ignore two urls for markup error (if command found any markup error into these dir, write it into output but the email subject isn't set to ALERT):
101+
```bash
102+
php artisan google-markup:test /path/to/my/url.txt --mail=mymail@mydomain --whitelist="https://www.padosoft.com,https://blog.padosoft.it"
103+
```
104+
105+
## SCHEDULE COMMAND
106+
107+
You can schedule a daily (or weekly etc..) report easly, by adding this line into `schedule` method in `app/Console/Kernel.php` :
108+
```php
109+
// app/console/Kernel.php
110+
111+
protected function schedule(Schedule $schedule)
112+
{
113+
...
114+
$schedule->command('google-markup:test "/path/to/my/url.txt" --mail=mymail@mydomain')
115+
->daily()
116+
->withoutOverlapping()
117+
->sendOutputTo(Config::get('laravel-google-structured-data-testing-tool.logFilePath'));
118+
}
119+
```
120+
121+
## SCREENSHOOTS
122+
123+
OUTPUT CONSOLE WITH ONE URL TEST:
124+
![screenshoot](https://raw.githubusercontent.com/padosoft/laravel-google-structured-data-testing-tool/master/resources/img/url-ok.png)
125+
126+
OUTPUT CONSOLE BULK CHECK OK:
127+
![screenshoot](https://raw.githubusercontent.com/padosoft/laravel-google-structured-data-testing-tool/master/resources/img/bulk-ok.png)
128+
129+
OUTPUT CONSOLE BULK CHECK WITH ERRORS:
130+
![screenshoot](https://raw.githubusercontent.com/padosoft/laravel-google-structured-data-testing-tool/master/resources/img/bulk-with-errors.png)
131+
132+
EMAIL VIEW:
133+
![screenshoot](https://raw.githubusercontent.com/padosoft/laravel-google-structured-data-testing-tool/master/resources/img/email-ok.png)
134+
135+
EMAIL VIEW WITH ERRORS:
136+
![screenshoot](https://raw.githubusercontent.com/padosoft/laravel-google-structured-data-testing-tool/master/resources/img/email-with-error.png)
137+
138+
139+
## Change log
140+
141+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
142+
143+
## Testing
144+
145+
``` bash
146+
$ composer test
147+
```
148+
149+
## Contributing
150+
151+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
152+
153+
## Security
154+
155+
If you discover any security related issues, please email instead of using the issue tracker.
156+
157+
## Credits
158+
- [Lorenzo Padovani](https://github.com/lopadova)
159+
- [All Contributors](../../contributors)
160+
161+
## About Padosoft
162+
Padosoft (https://www.padosoft.com) is a software house based in Florence, Italy. Specialized in E-commerce and web sites.
163+
164+
## License
165+
166+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)