Skip to content

Commit

Permalink
Add predict API
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriceclementz committed Feb 19, 2017
1 parent d6ac52f commit 7776b1d
Show file tree
Hide file tree
Showing 16 changed files with 2,189 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
index.php
coverage
vendor
25 changes: 25 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
inherit: true

tools:
external_code_coverage: true

checks:
php:
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true
code_rating: true
duplication: true

filter:
paths: [src/*, tests/*]
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: php

php:
- 7.0
- 7.1

before_script:
- composer self-update
- composer install

script:
- vendor/bin/phpunit --testdox --coverage-text --coverage-clover coverage.clover

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

branches:
only:
- master
22 changes: 22 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Code of Conduct

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.

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.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct.

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.

This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

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/)
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing

Contributions are welcome! Create an issue, explaining a bug or proposal. Submit pull requests if you feel brave.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Clarifai API Client

A PHP client for the [Clarifai API](https://developer.clarifai.com).

Work in progress.

## Installation

### Via composer

```
composer require fabriceclementz/clarifai-php
```

## Usage

### Fetch an access token

```
use GuzzleHttp\Client as HttpClient;
use Fab\Clarifai\Client;
// Instantiate a new client.
$client = new Client(new HttpClient(), 'CLIENT_ID', 'CLIENT_SECRET');
// Fetch an access token.
$response = $client->accessToken();
```

### Predict the content of an image

```
$response = $client
->withAccessToken($response['access_token'])
->predict(['https://samples.clarifai.com/metro-north.jpg']);
```

## Testing

```
composer test
```
33 changes: 33 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "fabriceclementz/clarifai-php",
"description": "A PHP client for the Clarifai API.",
"homepage": "https://github.com/fabriceclementz/clarifai-php",
"license": "MIT",
"require": {
"php": ">=7.0",
"guzzlehttp/guzzle": "^6.2"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"mockery/mockery": "^0.9.8"
},
"autoload": {
"psr-4": {
"Fab\\Clarifai\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Fab\\Clarifai\\Tests\\": "tests/"
}
},
"authors": [
{
"name": "Fabrice Clementz",
"email": "[email protected]"
}
],
"scripts": {
"test": "vendor/bin/phpunit"
}
}
Loading

0 comments on commit 7776b1d

Please sign in to comment.