Skip to content

Commit

Permalink
Merge pull request #9 from hmerritt/release/v1.1.7
Browse files Browse the repository at this point in the history
Release/v1.1.7
  • Loading branch information
hmerritt authored Feb 26, 2022
2 parents 4e9ff99 + de73faa commit b9a3351
Show file tree
Hide file tree
Showing 11 changed files with 4,036 additions and 80 deletions.
49 changes: 49 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# PHP CircleCI 2.0 configuration file
# See: https://circleci.com/docs/2.0/language-php/
version: 2

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
test:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
# Specify the version you desire here
- image: cimg/php:8.1.2

# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
# "composer.lock" can be used if it is committed to the repo
- v1-dependencies-{{ checksum "composer.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run:
name: Setup & install dependencies
command: |
composer install --no-interaction
- run:
name: Enable PCOV, disable Xdebug
command: |
mkdir -p ./build/logs
sudo pecl install pcov
- run:
name: Tests
command: |
composer test
# php ./vendor/bin/php-coveralls -v

workflows:
version: 2
test:
jobs:
- test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vendor/*
build/*
src/cache/*
composer.lock
.phpunit.result.cache
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

49 changes: 22 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# PHP IMDB API

[![Latest Stable Version](https://poser.pugx.org/hmerritt/imdb-api/v/stable)](https://packagist.org/packages/hmerritt/imdb-api)
[![Build Status](https://travis-ci.org/hmerritt/php-imdb-api.svg?branch=master)](https://travis-ci.org/hmerritt/php-imdb-api)
[![CircleCI](https://circleci.com/gh/hmerritt/php-imdb-api/tree/master.svg?style=svg)](https://circleci.com/gh/hmerritt/php-imdb-api/tree/master)
[![Coverage Status](https://coveralls.io/repos/github/hmerritt/php-imdb-api/badge.svg?branch=master)](https://coveralls.io/github/hmerritt/php-imdb-api?branch=master)

PHP IMDB-API that can fetch film data and search results.




## Install

Install the latest version using [composer](https://getcomposer.org/).

```
$ composer require hmerritt/imdb-api
```




## Usage

```php
// Assuming you installed from Composer:
require "vendor/autoload.php";
Expand All @@ -36,15 +32,14 @@ $imdb->search("Apocalypse");
$imdb->film("tt0816692");
```


### Options

| Name | Type | Default Value | Description |
|--------------- |-------- |--------------------------------------- |----------------------------------------------------------------------------------------------- |
| `curlHeaders` | array | `['Accept-Language: en-US,en;q=0.5']` | Custom headers can be passed to `cURL` when fetching the IMDB page |
| `cache` | bool | `true` | Caches film data to speed-up future requests for the same film |
| `techSpecs` | bool | `true` | Loads a films technical specifications (this will take longer as it makes a separate request) |
| `category` | string | `all` | What category to search for (films `tt`, people `nm` or companies `co`) |
| Name | Type | Default Value | Description |
| ------------- | ------ | ------------------------------------- | --------------------------------------------------------------------------------------------- |
| `curlHeaders` | array | `['Accept-Language: en-US,en;q=0.5']` | Custom headers can be passed to `cURL` when fetching the IMDB page |
| `cache` | bool | `true` | Caches film data to speed-up future requests for the same film |
| `techSpecs` | bool | `true` | Loads a films technical specifications (this will take longer as it makes a separate request) |
| `category` | string | `all` | What category to search for (films `tt`, people `nm` or companies `co`) |

```php
$imdb = new Imdb;
Expand All @@ -63,8 +58,8 @@ $imdb->search("Interstellar", [
]);
```


### Best Match

If you do not know the imdb-id of a film, a search string can be entered. This will search imdb and use the first result as the film to fetch data for.

> Note that this will take longer than just entering the ID as it needs to first search imdb before it can get the film data.
Expand All @@ -75,31 +70,33 @@ If you do not know the imdb-id of a film, a search string can be entered. This w
$imdb->film("Apocalypse");
```




## Features

### Film Data

```
- Title
- Genres
- Year
- Rating
- Poster
- Length
- Plot
- Rating
- Rating Votes (# of votes)
- Poster
- Trailer
- id
- link
- Cast
- actor name
- actor id
- image
- character
- avatar
- avatar_hq (high quality avatar)
- Technical Specs
```


### Search

Search IMDB to return an array of films, people and companies

```
Expand All @@ -117,11 +114,9 @@ Search IMDB to return an array of films, people and companies
- image
```




## Dependencies

> All dependencies are managed automatically by `composer`.
- [php-html-parser](https://github.com/paquettg/php-html-parser)
- [filebase](https://github.com/tmarois/Filebase)
- [php-html-parser](https://github.com/paquettg/php-html-parser)
- [filebase](https://github.com/tmarois/Filebase)
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"tmarois/filebase": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "9.0",
"php-coveralls/php-coveralls": "^2.2"
"phpunit/phpunit": "9.5.16",
"php-coveralls/php-coveralls": "2.5.2"
},
"scripts": {
"test": "php vendor/phpunit/phpunit/phpunit"
Expand Down
Loading

0 comments on commit b9a3351

Please sign in to comment.