Skip to main content

Prerequisites

  • PHP: 7.2 or higher.
  • Composer: Dependency manager for PHP.

Step-by-Step Installation

1. Require Apivalk via Composer

Run the following command in your project root:
composer require apivalk/apivalk
While Apivalk is flexible, we recommend the following structure for your API:
src/
└── Http/
    └── Api/
        └── v1/
            └── Pet/
                ├── Controller/
                │   └── CreatePetController.php
                ├── Request/
                │   └── CreatePetRequest.php
                └── Response/
                    └── CreatePetResponse.php

3. Autoloading

Ensure your composer.json is configured to autoload your classes. For example:
{
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    }
}
After modifying composer.json, run:
composer dump-autoload

Next Steps

Once installed, proceed to the Configuration guide to set up your API entry point.