Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
epalmans committed Jan 10, 2020
1 parent 9246eca commit b22b323
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,33 @@ composer require palmans/laravel-openfoodfacts
```

## Usage
Find product details by barcode

#### Find product details by barcode
``` php
OpenFoodFacts::barcode('20203467');
```
... or directly retrieve a specific attribute:
``` php
OpenFoodFacts::barcode('20203467')->product_name; // 'Cantuccini with hazelnuts'
OpenFoodFacts::barcode('20203467')->image_url; // 'https://static.openfoodfacts.org/images/products/20203467/front_fr.4.400.jpg'
it returns an array with product details:
```
Array
(
[product_name] => Cantuccini with hazelnuts
[image_url] => https://static.openfoodfacts.org/images/products/20203467/front_fr.4.400.jpg
...
)
```

Find products that match a search term:
#### Find products that match a search term:
``` php
$collection = OpenFoodFacts::find('Coca Cola Zero');

//returns a Illuminate\Support\Collection with details of each product found
//returns a Illuminate\Support\Collection of arrays with details of each product found
```

### Testing

``` bash
composer test
```

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Credits

- [Eddie Palmans](https://github.com/palmans)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 comments on commit b22b323

Please sign in to comment.