Skip to content

Commit 483b24d

Browse files
authored
Merge pull request #40 from yukoff/feature/adjust-readme
Adjust description in README, add badges etc.
2 parents 952878b + c5e0b31 commit 483b24d

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
1-
## Description
2-
A Laraval Package for use together with the [php-tmdb/api](https://github.com/php-tmdb/api) TMDB Wrapper.
1+
# Laravel Package for TMDB API Wrapper
2+
3+
[![License](https://poser.pugx.org/php-tmdb/laravel/license.png)](https://packagist.org/packages/php-tmdb/laravel)
4+
[![Build Status](https://travis-ci.org/php-tmdb/laravel.svg)](https://travis-ci.org/php-tmdb/laravel)
5+
[![Code Coverage](https://scrutinizer-ci.com/g/php-tmdb/laravel/badges/coverage.png)](https://scrutinizer-ci.com/g/php-tmdb/laravel/)
6+
[![PHP & HHVM](https://php-eye.com/badge/php-tmdb/laravel/tested.svg)](https://php-eye.com/package/php-tmdb/laravel)
7+
8+
A Laravel package that provides easy access to the [php-tmdb/api](https://github.com/php-tmdb/api) TMDB (The Movie Database) API wrapper.
39
This package comes with a service provider that configures the `Tmdb\Client` and registers it to the IoC container.
410
Both Laravel 5 and 4 are supported.
511

12+
[![Latest Stable Version](https://poser.pugx.org/php-tmdb/laravel/v/stable.svg)](https://packagist.org/packages/php-tmdb/laravel)
13+
[![Latest Unstable Version](https://poser.pugx.org/php-tmdb/laravel/v/unstable.svg)](https://packagist.org/packages/php-tmdb/laravel)
14+
[![Dependency Status](https://www.versioneye.com/php/php-tmdb:laravel/badge?style=flat)](https://www.versioneye.com/php/php-tmdb:laravel)
15+
[![Total Downloads](https://poser.pugx.org/php-tmdb/laravel/downloads.svg)](https://packagist.org/packages/php-tmdb/laravel)
616

717
## Installation
18+
819
Install Composer
920

1021
```
1122
$ curl -sS https://getcomposer.org/installer | php
1223
$ sudo mv composer.phar /usr/local/bin/composer
1324
```
1425

15-
Add the following to your require block in composer.json config
26+
Add the following to your require block in `composer.json` config
1627

1728
```
1829
"php-tmdb/laravel": "~1.0"
1930
```
2031

32+
or just run the following command in your project:
33+
34+
```
35+
composer require php-tmdb/laravel
36+
```
37+
2138
## Configuration
22-
Add to your `app/config/app.php` (Laravel 4) or 'config/app.php' (Laravel 5) the service provider:
39+
40+
Add to your `app/config/app.php` (Laravel 4) or `config/app.php` (Laravel 5) the service provider:
2341

2442
```php
2543
'providers' => array(
@@ -31,12 +49,14 @@ Add to your `app/config/app.php` (Laravel 4) or 'config/app.php' (Laravel 5) the
3149

3250
Then publish the configuration file:
3351

34-
#### Laravel 4:
52+
### Laravel 4
53+
3554
```
3655
php artisan config:publish php-tmdb/laravel
3756
```
3857

39-
#### Laravel 5:
58+
### Laravel 5
59+
4060
```
4161
php artisan vendor:publish --provider="Tmdb\Laravel\TmdbServiceProviderLaravel5"
4262
```
@@ -46,11 +66,14 @@ Next you can modify the generated configuration file `tmdb.php` accordingly.
4666
That's all! Fire away!
4767

4868
## Usage
69+
4970
We can choose to either use the `Tmdb` Facade, or to use dependency injection.
5071

5172
### Facade example
73+
5274
The example below shows how you can use the `Tmdb` facade.
5375
If you don't want to keep adding the `use Tmdb\Laravel\Facades\Tmdb;` statement in your files, then you can also add the facade as an alias in `config/app.php` file.
76+
5477
```php
5578
use Tmdb\Laravel\Facades\Tmdb;
5679

@@ -65,6 +88,7 @@ class MoviesController {
6588
```
6689

6790
### Dependency injection example
91+
6892
```php
6993
use Tmdb\Repository\MovieRepository;
7094

@@ -86,8 +110,10 @@ class MoviesController {
86110
```
87111

88112
### Listening to events
113+
89114
We can easily listen to events that are dispatched using the Laravel event dispatcher that we're familiar with.
90115
The following example listens to any request that is made and logs a message.
116+
91117
```php
92118
use Log;
93119
use Event;
@@ -99,9 +125,11 @@ Event::listen(TmdbEvents::REQUEST, function(RequestEvent $event) {
99125
// do stuff with $event
100126
});
101127
```
128+
102129
In Laravel 5 instead of using the `Event` facade we could also have used the `EventServiceProvider` to register our event listener.
103130

104131
### Image helper
132+
105133
You can easily use the `ImageHelper` by using dependency injection. The following example shows how to show the poster image of the 20 most popular movies.
106134

107135
```php
@@ -139,8 +167,10 @@ class WelcomeController extends Controller {
139167

140168
}
141169
```
170+
142171
The `Configuration` used by the `Tmdb\Helper\ImageHelper` is automatically loaded by the IoC container.
143172
If you are a Laravel 5.1 user you could also use the blade's `@inject` functionality,
173+
144174
```
145175
@inject('image', 'Tmdb\Helper\ImageHelper')
146176
@@ -150,7 +180,9 @@ If you are a Laravel 5.1 user you could also use the blade's `@inject` functiona
150180
```
151181

152182
### Registering plugins
183+
153184
Plugins can be registered in a service provider using the `boot()` method.
185+
154186
```php
155187
namespace App\Providers;
156188

0 commit comments

Comments
 (0)