liberty_code/open_api

Library

Maintainers

Package info

bitbucket.org/libertysoft/libertycode_openapi

Issues

Forum

pkg:composer/liberty_code/open_api

Transparency log

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

v1.0.0 2026-08-18 15:57 UTC

This package is not auto-updated.

Last update: 2026-08-19 14:25:43 UTC


README

Description

Library contains Open API components, to handle Open API specifications.

Requirement

  • Script language: PHP: version 7 || 8

Installation

Several ways are possible:

Composer

  1. Requirement

    It requires composer installation. For more information: https://getcomposer.org

  2. Command: Move in project root path

     cd "<project_root_path>"
    
  3. Command: Installation

     php composer.phar require liberty_code/open_api ["<version>"]
    
  4. Note

    • Include vendor

      If project uses composer, vendor must be included:

        require_once('<project_root_path>/vendor/autoload.php');
      
    • Configuration

      Installation command allows to add, on composer file "/composer.json", following configuration:

        {
            "require": {
                "liberty_code/open_api": "<version>"
            }
        }
      

Include

  1. Download

    • Download following repository.
    • Put it on repository root path.
  2. Include source

     require_once('<repository_root_path>/include/Include.php');
    

Usage

Specification parser

Specification parser allows to get parsed specification data, for specific specification.

Elements

  • SpecParser

    Allows to design specific specification parser, to get parsed specification data, for specific specification.

  • ParserSpecParser

    Extends specification parser features. Allows to get parsed specification data, from specific parser, and specified specification.

  • SpecParserCollection

    Allows to design collection of specification parsers.

  • SpecParserFactory

    Allows to design specification parser factory, to provide new or specified specification parser instance, from specified configuration.

  • BaseSpecParserFactory

    Extends specification parser factory features. Can be consider as base of all specification parser factories.

  • StandardSpecParserFactory

    Extends base specification parser factory features. Provides specification parser instance.

  • SpecParserBuilder

    Uses array of source data to hydrate specification parser collection.

Example

// Get specification parser factory
use liberty_code\open_api\parser\factory\standard\model\StandardSpecParserFactory;
$specParserFactory = new StandardSpecParserFactory($parserFactory);
...
// Get new specification parser, from configuration
$specParser = $specParserFactory->getObjSpecParser(array(...));
...
// Get parsed specification data
var_dump($specParser->getTabSpecData());
...
// Get specification parser collection
use liberty_code\open_api\parser\model\DefaultSpecParserCollection;
$specParserCollection = new DefaultSpecParserCollection();
...
// Get specification parser builder
use liberty_code\open_api\parser\build\model\DefaultSpecParserBuilder;
$specParserBuilder = new DefaultSpecParserBuilder($specParserFactory);
...
// Hydrate specification parser collection
$specParserBuilder->setTabDataSrc(array(...));
$specParserBuilder->hydrateSpecParserCollection($specParserCollection);
...
foreach($specParserCollection->getTabKey() as $key) {
    echo($specParserCollection->getObjSpecParser($key)->getStrKey() .'<br />');
}
/**
 * Show: 
 * Specification parser key 1
 * ...
 * Specification parser key N
 */
...

Utility

  • Component

    Component features.

  • Operation

    Operation features.

Test

Unit test

Unit tests allows to test components features, and to automate their validation.

  1. Requirement

    • Composer

      It requires composer installation. For more information: https://getcomposer.org

    • Command: Dependencies installation

        php composer.phar install
      
  2. Command: Run unit tests

     vendor\bin\phpunit
    
  3. Note

    It uses PHPUnit to handle unit tests. For more information: https://phpunit.readthedocs.io