Skip to main content
Version: 10.x

Frequently Asked Questions

Do I have to use the Porto Architecture to benefit from Apiato!?

No. You can still use the standard MVC (Controllers are still there) or any other architecture you prefer, and you can call the Apiato provided Actions and Tasks from your Controllers or Services or whichever classes you prefer. You have the freedom to structure your own project anyway you like, and still use all the feature that Apiato provide.

How to use my custom domain?

Read the installation guide.

Where to put my frontend code?

It's recommended that the front-end App codes live outside apiato completely. Example in clients/web/ directory, separated from the Server code (apiato Code).

The front-end App should be able to run as a stand-alone App, and it can consume the Server API or other Testing API's.

You can configure NGINX to serve the Front-end and the Back-end each on a different domain or on subdomains (Example app.com for the front-end App and api.app.com for the API).

However, apiato does support serving HTML from within. So only of you prefer, you can serve HTML from apiato directly same as serving the API.

In this case the code will live in:

- MyProject
- app
- Containers
- Section-Z
- Container-X
- UI
- API
- WEB // <<
- Views
- CLI
- Container-Y
- UI
- API
- WEB // <<
- Views
- CLI

Where do I register Service Providers and Aliases?

Most of the third party package Service Providers and Aliases SHOULD be registered inside the Container's Main Service Providers, inside the $serviceProviders and $aliases properties. However, some more general Service Providers and Aliases (application features used by all containers) CAN be registered on the Ship layer in app/Ship/Providers/ShipProvider.php inside the $serviceProviders and $aliases properties.

Refer to the Providers page for more details.

How to change the default API URL (Subdomain and Prefix)?

By default, Apiato uses api. as subdomain for all endpoints and adds only the v1 API version as prefix.

To change this from api.apiato.test to apiato.test/api/, do the following:

  1. Edit .env, change your api domain to API_URL=http://apiato.test instead of API_URL=http://api.apiato.test to remove the subdomain.
  2. Edit app/Ship/Configs/apiato.php, set prefix to 'prefix' => 'api/',.
  3. That's it. Now you might need to update your tests endpoints, if they fail. Since each test can specify which endpoint to test, Example: In app/Containers/AppSection/User/UI/API/Tests/Functional/CreateAdminTest change protected $endpoint = 'post@v1/admins'; to protected $endpoint = 'post@api/v1/admins';, including the new prefix.

To remove the version prefix as well, set enable_version_prefix to false in app/Ship/Configs/apiato.php.

Where do I define my Composer dependencies?

All the Composer dependencies should be defined in their Containers, in a composer.json file.

The Ship layer dependencies live on the root of the Ship layer in a composer.json file. Finally, the Framework core dependencies live on the project root composer.json file.

Basically using any of the composer.json will do the same job. it's up to you to pick the most relevant location.

How to enable Query Caching?

By default, this feature is turned off.

To turn it on, go to the .env file and set ELOQUENT_QUERY_CACHE=true. The query result will be cleared on create, update and delete.

All these configurations can be changed from app/Ship/Configs/repository.php.

Can I give my Actions REST names?

Example: IndexAction, ShowAction, StoreAction...

Yes, you can name anything, anyway you prefer, sa long as you’re just changing the name and not the naming format “like in case of routes files, they include the version number which gets applied to the api, and the api type to help to add the route file to different docs automatically”.

The goal of giving the Actions and Tasks… a descriptive long names is, to be able to understand what’s going on inside the class before opening it, and there’s php artisan apiato:list:actions command which list all the use cases “Actions” in your system, so you can see what you already implemented and what needs to be done. If your Action name is “ShowAction” you will see 50 of them without really knowing what the action is doing!

I prepend the container name before the action name, but still a maintainable code means anyone who reads it can understand it without any explanation from the original writer! so I personally prefer ShowTotalNumberOfUsersAction than ShowAction.

How are Service Providers auto-loaded?

Each Container has Main Provider and other Providers (Additional Providers). When runLoadersBoot() is called, it auto register ShipProvider and all the Main Providers from all the Containers.

The ApiatoProvider is the one who calls runLoadersBoot() on startup. ApiatoProvider is automatically registered using Laravel auto-discovery feature.

How to create third-party Containers?

Read the Container Installer Documentation.

What is the default Username for authentication?

The default credentials to login are:

I have a question, and I can't find answer!!

If you have a question, or did not find an answer you were looking for on StackOverflow. First make sure your question is related to Apiato and is not a general question. If so, then consider visiting the Apiato Github Issues and searching for keywords related to your issue (filter open and closed issues). Another option you have is to get help from the community on Discord.

Lastly, if you got your question answered, consider sharing it, if you believe it can help others. You can submit a PR adding the questions and answer here on the FAQ page. Or leave it somewhere on the repository or on the chat room. Thanks in advance :)