Skip to content

Commit 642957a

Browse files
authored
Merge pull request #8 from shweshi/dev
Auto discovery of providers and facades for laravel >=5.5
2 parents 55539e5 + c67caa3 commit 642957a

8 files changed

Lines changed: 1350 additions & 21 deletions

File tree

.scrutinizer.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
filter:
2+
excluded_paths: []
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

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
All notable changes to `OpenGraph` will be documented in this file
4+
5+
## 1.0.2 - 2018-11-23
6+
- Added tests and autoload for laravel >= 5.5
7+
8+
## 1.0.1 - 2018-01-17
9+
- Fix autoload
10+
11+
## 1.0.0 - 2018-01-17
12+
13+
- initial release

README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpenGraph
1+
# Laravel OpenGraph
22
A Laravel package to fetch Open Graph metadata of a website.
33

44
[![Latest Version on Packagist](https://img.shields.io/packagist/v/shweshi/OpenGraph.svg?style=flat-square)](https://packagist.org/packages/shweshi/OpenGraph)
@@ -9,8 +9,14 @@ A Laravel package to fetch Open Graph metadata of a website.
99

1010
## Installation
1111
Perform the following operations in order to use this package
12-
- Run `composer require "shweshi/opengraph"` in your terminal
13-
- **Add Service Provider**
12+
- Install via composer
13+
```
14+
composer require "shweshi/opengraph"
15+
```
16+
17+
If you do not run Laravel 5.5 (or higher), then add the service provider in config/app.php:
18+
19+
- **Add Service Provider**
1420
Open `config/app.php` and add `shweshi\OpenGraph\Providers\OpenGraphProvider::class,` to the end of `providers` array:
1521

1622
```
@@ -27,15 +33,34 @@ Perform the following operations in order to use this package
2733
'OpenGraph' => shweshi\OpenGraph\Facades\OpenGraphFacade::class
2834
),
2935
```
36+
37+
If you do run the package on Laravel 5.5+, package auto-discovery takes care of the magic of adding the service provider.
38+
3039
## Requirements
3140
- You need to install the [DOM](http://www.php.net/en/dom) extension.
3241
3342
## How to use
3443
35-
- After following the above steps,
44+
- After following the above steps,
3645
3746
```
47+
use OpenGraph;
48+
3849
$data = OpenGraph::fetch("https://unsplash.com/");
3950
40-
print_r($data);
4151
```
52+
53+
this will give you an array like this..
54+
55+
```
56+
array (
57+
'title' => 'Beautiful Free Images & Pictures | Unsplash',
58+
'description' => 'Beautiful, free images and photos that you can download and use for any project. Better than any royalty free or stock photos.',
59+
'type' => 'website',
60+
'url' => 'https://unsplash.com/',
61+
'image' => 'http://images.unsplash.com/photo-1542841791-1925b02a2bbb?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEyMDd9&s=aceabe8a2fd1a273da24e68c21768de0',
62+
'image:secure_url' => 'https://images.unsplash.com/photo-1542841791-1925b02a2bbb?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEyMDd9&s=aceabe8a2fd1a273da24e68c21768de0',
63+
)
64+
```
65+
66+
### Happy coding!

composer.json

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,39 @@
11
{
2-
"name": "shweshi/opengraph",
3-
"description": "A Laravel package to fetch website Open Graph metadata.",
4-
"type": "library",
5-
"authors": [
6-
{
7-
"name": "Shashi Prakash Gautam",
8-
"email": "contactmespg@gmail.com"
9-
}
10-
],
11-
"require": {},
12-
"license": "MIT",
13-
"autoload": {
14-
"psr-4": {
15-
"shweshi\\OpenGraph\\": "src/"
16-
}
2+
"name": "shweshi/opengraph",
3+
"description": "A Laravel package to fetch website Open Graph metadata.",
4+
"type": "library",
5+
"authors": [
6+
{
7+
"name": "Shashi Prakash Gautam",
8+
"email": "contactmespg@gmail.com"
179
}
10+
],
11+
"require": {},
12+
"require-dev": {
13+
"phpunit/phpunit": "4.8.*"
14+
},
15+
"license": "MIT",
16+
"autoload": {
17+
"psr-4": {
18+
"shweshi\\OpenGraph\\": "src/"
19+
}
20+
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"shweshi\\OpenGraph\\Test\\": "tests"
24+
}
25+
},
26+
"scripts": {
27+
"test": "vendor/bin/phpunit"
28+
},
29+
"extra": {
30+
"laravel": {
31+
"providers": [
32+
"shweshi\\OpenGraph\\Providers\\OpenGraphProvider"
33+
],
34+
"aliases": {
35+
"OpenGraph": "shweshi\\OpenGraph\\Facades\\OpenGraphFacade"
36+
}
37+
}
38+
}
1839
}

0 commit comments

Comments
 (0)