Download the PHP package josmlt/spoonacular-laravel-wrapper without Composer
On this page you can find all versions of the php package josmlt/spoonacular-laravel-wrapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package spoonacular-laravel-wrapper
Spoonacular Laravel Wrapper
- Spoonacular Laravel Wrapper
- What is :memo:
- Purpose
- Steps to installation :information_source:
- Package Locally Development :information_source:
- From Packagist :information_source:
- How to use it :question:
- Testing :heavy_check_mark:
What is :memo:
It's a package that uses Facades to request resources from Spoonacular API, like recipes, random recipes, nutrients and offers different sort options like for calories, intolerances etc.
Purpose
It was made to learn how Facades and Laravel packages works.
Steps to installation :information_source:
It's necessary register in Spoonacular and get an api key.
Package Locally Development :information_source:
We need to create a folder, within it we create a Laravel project and clone the repository. Structure similar to this :
After that, open composer.json
file in our main Laravel project, add the next properties :
Next step is require the package to our project, execute :
We'll see the message: Installing josmlt/spoonacular-laravel-wrapper (dev-master): Junctioning from ../spoon-wrapper
Then execute the follow command, it publishes the config file :
Finally we have two options, first we could have a default value of SPOONACULAR_API_KEY, within config/spoonacular.php
or as well we can add in our .env
a new environment variable like SPOONACULAR_API_KEY = ""
From Packagist :information_source:
We need to pull the package from packagist to our Laravel project.
After a correct installation, we need to publish a custom config file, execute:
Finally, we move into :
And add our api key from Spoonacular, or alternative you can create a new environment variable named like SPOONACULAR_API_KEY
.
How to use it :question:
:point_right: If we want to get recipes with tomato, for example, we just need to search recipes with this keyword, type:
:point_right: But what else? If you need a complex search, because for example you're intolerant with eggs or you want order the results for amount of calories ... Type :
:point_right: Or get random recipes :
Testing :heavy_check_mark:
This package provides a few tests, the objective is to get more confident using the package and check if it's possible add a new feature without broke nothing valuable.
Within the package, execute the follow :
vendor/bin/phpunit tests/Unit/SpoonacularFacadeTest.php
Don't forget execute composer install
after download or clone the project, also get a valid APIKEY.