2017 © Pedro Peláez
 

library annotations

image

php-platform/annotations

  • Tuesday, June 26, 2018
  • by Raaghu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,948 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

PHP Platform Annotations

This package provides APIs to access annotations in PHP, (*1)

Build Status, (*2)

Usage

Getting the Annotations

``` PHP PhpPlatform\Annotations\Annotation::getAnnotations($className, $propertyName="", $constantName="", $methodName="*");, (*3)

where 
 - `$className` is complete name of the class for which annotations are needed
 - `$propertyName` is a *string* of a property or *array* of properties for which annotations are needed
 - `$constantName` is a *string* of a constant or *array* of constants for which annotations are needed 
 - `$methodName` is a *string* of a method name or *array* of method names for which annotations are needed

### Declaring Annotations

This library supports annotations in DocComments 
Annotation declaration has the format of 
  • @KEY VALUE(S)
Where `KEY` may contain subkeys seperated by `.`
and `VALUES` are `space` or `comma` seperated strings


## Example
This Example shows the different forms of annotations and their expected values 
```php
/**
 * @key1
 *  @key2
 * @key3.subKey1
 * @key3.subKey2.subkey21 success
 * @key4 v1
 * @key5 (v2)
 * @key6 v3 v4
 * @key7 "v5\"With Space and Quotes\""
 * @key8 ("v6\"With Space and Quotes\"", v7) 
 * @key9 ("v8\"With Space and Quotes\"", v9) description1
 * @key10 ("v10 With \\", v11) description2
 * @key11 ("123", v12) description3
 * @key12 ("true", "false")
 * @key13 v13
 * @key13 1234
 * @key14 (v14)
 * @key14 v15
 * @ notKey
 * @wrongKey(v16) desc
 *  
 */
public $testDifferrentFormatsOfAnnoptations;

The array of annotations returned from, (*4)

PhpPlatform\Annotations\Annotation::getAnnotations($className, 'testDifferrentFormatsOfAnnoptations');

Will be, (*5)

[
    "testDifferrentFormatsOfAnnoptations" => [
        "key1" => true,
        "key2" => true,
        "key3" => [
            "subKey1" => true,
            "subKey2" => [
                "subkey21" => "success"
            ]
        ],
        "key4" => "v1",
        "key5" => ["v2"],
        "key6" => ["v3", "v4"],
        "key7" => 'v5"With Space and Quotes"',
        "key8" => ['v6"With Space and Quotes"', "v7"],
        "key9" => ['v8"With Space and Quotes"', "v9"],
        "key10" => ["v10 With \\", "v11"],
        "key11" => [123, "v12"],
        "key12" => [true, false],
        "key13" => ['v13', 1234],
        "key14" => ["v14", "v15"]
    ]
]

The Versions

26/06 2018

v0.1.x-dev

0.1.9999999.9999999-dev https://github.com/PHPPlatform/annotations

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

annotations php-platform

26/06 2018

v0.1.2

0.1.2.0 https://github.com/PHPPlatform/annotations

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

annotations php-platform

26/06 2018

dev-master

9999999-dev https://github.com/PHPPlatform/annotations

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

annotations php-platform

09/01 2017

v0.1.1

0.1.1.0 https://github.com/PHPPlatform/annotations

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

annotations php-platform

06/01 2017

v0.1.0

0.1.0.0 https://github.com/PHPPlatform/annotations

  Sources   Download

The Requires

  • php ~5.3

 

The Development Requires

annotations php-platform