-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. |