PHP code example of ride / lib-api

1. Go to this page and download the library: Download ride/lib-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ride / lib-api example snippets




use ride\library\api\doc\DocParser;
use ride\library\api\ApiBrowser;
use ride\library\system\file\FileSystem;

function createApiBrowser(FileSystem $fileSystem) {
    $piBrowser($docParser, $fileSystem, $namespace
    $subNamespaces = $apiBrowser->getNamespaces('ride\\library\\api');
    // array(
    //     'ride\\library\\api' => 'ride\\library\\api', 
    //     'ride\\library\\api\\doc' => 'ride\\library\\api\\doc', 
    //     'ride\\library\\api\\doc\\tag' => 'ride\\library\\api\\doc\\tag', 
    //     'ride\\library\\api\\io' => 'ride\\library\\api\\io', 
    //     'ride\\library\\api\\reflection' => 'ride\\library\\api\\reflection', 
    // );
    
    $classes = $apiBrowser->getClassesForNamespace('ride\\library\\api');
    // array(
    //     'ride\\library\\api\\ApiBrowser' => 'ApiBrowser',
    // );
    
    $class = $apiBrowser->getClass('ride\\library\\api\\ApiBrowser');
    
    $doc = $class->getDoc();
    $type = $class->getTypeAsString(); // abstract class, interface
    
    // an array with for each class, the methods it overrides or implements 
    $inheritance = $class->getInheritance();
    // array(
    //     'className' => array(
    //          'methodName' => 'ReflectionMethod',
    //     ), 
    // );
    
    // an array with all classes it extends or implements
    $parents = $class->getParentArray();
    // array(
    // );
    
    $methods = $class->getMethods();
    foreach ($methods as $methodName => $method) {
        $doc = $method->getDoc();
        $type = $method->getTypeAsString(); // abstract protected, ...
        $source = $method->getSource();
        
        $forInterface = $class->getMethodInterface($methodName);
        $false = $method->isInherited('ride\\library\\api\\ApiBrowser');
    }
    
    $properties = $class->getProperties();
    foreach ($properties as $propertyName => $property) {
        $doc = $property->getDoc();
        $type = $property->getTypeAsString();
    }
    
    $constants = $class->getConstants();
    foreach ($constants as $name => $value) {
        
    }
}


    /**
     * Gets a list of namespaces
     * @param string $namespace Filter namespaces with the provided namespace
     * @return array Ordered array with the namespace as key and value
     */