1martinkarlsen/apilyser

API documentation and code validator

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/1martinkarlsen/apilyser

v0.0.1 2025-12-25 16:15 UTC

This package is auto-updated.

Last update: 2025-12-25 16:29:11 UTC


README

A PHP static analysis tool to discover misalignment between the code and the OpenApi documentation

Getting started

Installation

Install using composer
The library is still under development

Configuration

After installation, a apilyzer.yaml file is required for the library to work.

Configuration description
codePath path to the code
openApiPath path to the open api documentation yaml file

Usage

You can run the simple validation command by typing
./vendor/bin/apilyser validate

This command will analyse both the OpenApi dokumentation and the project code and run the alignment rules.

Add custom routing parsers.

Apilyser allows you to add custom routing parsers to support different routing systems or frameworks.

To add a custom parser, create a class that implements the RouteStrategy interface and add it to your apilyser.yaml configuration:

codePath: src/
openApiPath: openapi.yaml
customRouteParser:
  - 'App\ApilyserExtensions\MyCustomParser'
  - 'App\ApilyserExtensions\AnotherParser'

Your custom parser class should implement the RouteStrategy interface and be autoloaded in your project.

Example custom parser:

namespace App\ApilyserExtensions;

use Apilyser\Parser\Route\RouteStrategy;

class MyCustomParser implements RouteStrategy
{
    public function canHandle(string $rootPath): bool
    {
        return true;
    }

    public function parseRoutes(string $rootPath): array
    {
        return $routes;
    }
}

Contribution

Contributions are very welcome!
For major changes, please open an issue to discuss first. Otherwise feel free to create pull requests.