Learn About API Testing Tool in Laravel 8 Tutorial

Share this Article
Reading Time: 4 minutes
891 Views

For API testing, we generally use many tools or browser extensions, for example – postman. Inside this article we will discuss a API testing tool in laravel 8, which we can create by the help of a composer package.

This tutorial will be step by step guide to install, create & test api tool in laravel 8.

This composer package provides the API testing UI, request flow, parameters etc. Here you will get the complete guide to develop API testing tool in laravel 8.

We can test all restful web services by this tool as well.

Learn How to create Admin panel in Laravel 8 using Voyager there, Click here.

Let’s get started.


Installation of Laravel Application

Laravel Installation can be done in two ways.

  • Laravel Installer
  • By using composer

Laravel Installer

To install Laravel via Laravel installer, we need to install it’s installer first. We need to make use of composer for that.

$ composer global require laravel/installer

This command will install laravel installer at system. This installation is at global scope, so you type command from any directory at terminal. To verify type the given command –

$ laravel

This command will open a command palette of Laravel Installer.

To create ad install laravel project in system,

$ laravel new blog

With the name of blog a laravel project will be created at your specified path.

By using composer

Alternatively, we can also install Laravel by Composer command create-project.

If your system doesn’t has composer Installed, Learn Composer Installation Steps.

Here is the complete command to create a laravel project-

$ composer create-project --prefer-dist laravel/laravel blog

After following these steps we can install a Laravel application into system.

To start the development server of Laravel –

$ php artisan serve

This command outputs –

Starting Laravel development server: http://127.0.0.1:8000

Assuming laravel already installed at system.


Install laravel-api-tester Package

Open project into terminal and run this composer command.

$ composer require asvae/laravel-api-tester

RESTful APIs Development

To learn about the complete concept of developing restful apis in laravel 8 using passport, Click here.

We will test the above created apis into this api testing tool of laravel. This API tool is not only for APIs even we can test our application normal routes as well using GET & POST request type.

Create Example Route

Open api.php from /routes folder and add this.

//...

Route::get('sample-message', function () {

    return response()->json(array(
        "status" => 1,
        "message" => "API testing tool is working fine"
    ));
});

Application Testing

Open project to terminal and type the command to start development server

$ php artisan serve

URL to open API Tester – http://127.0.0.1:8000/api-tester

This is similar to all API testing tools, but this time we have developed using a composer package of laravel.

Testing Example Route in Tool

If we scroll down the above screen, we should see the output.

We hope this article helped you to learn about Learn About API Testing Tool in Laravel 8 Tutorial in a very detailed way.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Find More on Laravel 8 Articles here