(Test Driven Development) (31-Jul-2023) With Laravel 10 we query the movies endpoint at www.rapidapi.com/rapidapi/api/movie-database-alternative/ I have been working with Laravel since Laravel 5.4 - www.endoflife.date/laravel
php artisan tinker
> $m = new \App\Models\Movie;
= App\Models\Movie {#6216}
> $m->searchApi('Avengers')
= {#6230
+"Search": [
{#6227
+"Title": "The Avengers",
+"Year": "2012",
+"imdbID": "tt0848228",
+"Type": "movie",
+"Poster": "https://m.media-amazon.com/images/M/MV5BNDYxNjQyMjAtNTdiOS00NGYwLWFmNTAtNThmYjU5ZGI2YTI1XkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SX300.jpg",
},
{#6235
+"Title": "Avengers: Endgame",
+"Year": "2019",
+"imdbID": "tt4154796",
+"Type": "movie",
+"Poster": "https://m.media-amazon.com/images/M/MV5BMTc5MDE2ODcwNV5BMl5BanBnXkFtZTgwMzI2NzQ2NzM@._V1_SX300.jpg",
},
{#6240
+"Title": "Avengers: Infinity War",
+"Year": "2018",
+"imdbID": "tt4154756",
+"Type": "movie",
...
- PHP and MySQL
- Yarn (can be installed with
npm i -g yarn
) - https://laravel.com/docs/10.x/installation
- https://laravel.com/docs/10.x/mix#main-content
Create our environment file.
cp .env.example .env
Install our app dependencies.
composer i
Generate app key.
# php artisan key:generate
composer run post-create-project-cmd
Run migrations with seeders.
php artisan migrate --seed
Install javascript required packages.
yarn && yarn build
# Do `yarn dev` during development to see live changes
# of your blade and js and css/scss dependencies with vite.config.js
# php artisan serve
php artisan serve --port 3000
php artisan route:list
# example output:
...
POST api/user ............................ login › Api\UserController@login
GET|HEAD api/user/authorize .................. Api\UserController@authorizeUser
POST api/user/register ................... Api\UserController@register
...
# php artisan test --filter api
php artisan test
See food nutrition facts search web app.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.