Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

noblemfd's avatar

Unable to boot ApiServiceProvider, configure an API domain or prefix

I am using Laravel-8 as restful api. Also I am using Dingo Package. Initially the url was:

http://localhost:8888/myapp/server/public

And it was loading correctly.

However, I decided to remove public from the url. So I followed these steps:

  1. Rename server.php in your Laravel root folder to index.php
  2. Copy the .htaccess file from /public directory to your Laravel root folder.

When I tried to reload the url as:

http://localhost:8888/myapp/server

I got this error:

Unable to boot ApiServiceProvider, configure an API domain or prefix

C:\xampp\htdocs\myapp\server\vendor\dingo\api\src\Provider\DingoServiceProvider.php

protected function registerConfig()
{
    $this->mergeConfigFrom(realpath(__DIR__.'/../../config/api.php'), 'api');

    if (! $this->app->runningInConsole() && empty($this->config('prefix')) && empty($this->config('domain'))) {
        throw new RuntimeException('Unable to boot ApiServiceProvider, configure an API domain or prefix.');
    }
}

Even with:

http://localhost:8888/mygeapp/server/public/

The same error still applies

How do I resolve this?

Thanks

0 likes
5 replies
bugsysha's avatar

My suggestion is to avoid that package. I've had issues with it recently that required days of work (and I'm still not happy with the solution), while I could solve the problem in max two hours without it.

When you change domain or prefix you can do it through .env file with API_PREFIX and API_DOMAIN variables.

noblemfd's avatar

@bugsysha - Is there any other alternative to the package? I need to do api versioning and documentation

bugsysha's avatar

You can do versioning in Laravel and there is a bunch of packages for documentation like Swagger.

Please or to participate in this conversation.