Now lets run vendor publish to get the api config file setup. leave other lines intact, just add the below.ĭingo\Api\Provider\LaravelServiceProvider::class We now want to make some changes to the config in Laravel, so using Atom open “config/app.php” and add a line to the bottom of the service providers array. composer require will go and do the heavy lifting, grabbing dependencies and setting up dingo for us. Next, lets grab Dingo API, which we’ll be using in the project to perform our REST requests. Let’s create a new git repository here, and commit the current files. Now, probably the first thing we want to do is get some version control going on in case we screw up. Once finished and dropped back to the command prompt, go into the new directory and launch Atom in the current directory. You’ll get some output about crafting a new application, just let it do it’s thing. Open up a new terminal and create a new Laravel application called api: laravel new api It’s also worth downloading Postman from the Chrome app store, unless you’re a curl lover it just makes things easier later. Atom is great out of the box, but take a look at plugins to make it far more powerful as a development tool. I’ll be focusing on Atom as it’s more accessible due to it’s open source development. Just quickly, I use either Sublime text (paid for) or Atom (free and open source) for development. If you have any problems I’d suggest going to the Laravel website and checking for up to date installation instructions. You should be able to install Laravel globally using composer: composer global require "laravel/installer" I don’t intend to cover the installation of composer here, but you can find out up to date information from their website . This is required to complete the rest of the guide. I’m calling mine “api” in order to remain as simple as possible. You can optionally create a limited user account (highly recommended), but since this is a local development environment I’ll just be using root credentials to allow it access to the database.Ĭreate a database for the project. Set a memorable but secure root password. sudo apt-get install php5-cli git mysql-server mysql-client MySQL I’m using a Linux Mint 17.2, so I’ll be using apt-get. Installing pre-requisitesįirst off, you need to get the latest viable version of PHP and git for your OS. You can of course use Homestead if that’s your preferred development method, but I can’t stand virtual machines eating system resources. I’ll be using a Linux operating system to do development without using Laravel’s Homestead. So, the first thing to do is create a new environment for development. The tutorial will focus around a fictional company that receives orders for garments from a number of 3rd party suppliers. 3rd parties place orders for items via the API, which then get dispatched to a recipient. In this series, I’m going to be writing about the creation of an API with Laravel 5.2 and Dingo API.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |