2017 © Pedro Peláez
 

library annotation

A PHP library to parse annotations

image

gabrielfs7/annotation

A PHP library to parse annotations

  • Monday, October 27, 2014
  • by gabrielfs7
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Annotation PHP!

Create and retrieve content from your own PHP Class Annotations!, (*1)

Samples

 'b',
 *         'c' => 'c',
 *         [
 *             'd' => ['e', 'f']
 *         ]
 *     ]
 * )
 * @myAnnotationArray2(
 *     'a' => 'b',
 *     'c' => 'c',
 *     [
 *         'd' => ['e', 'f']
 *     ]
 * )
 */
class SampleClass
{

    /**
     * @myAnnotationBoolean(true)
     * @myAnnotationString('String name')
     * @myAnnotationString2(String name)
     * @myAnnotationNumber(123)
     * @myAnnotationNumber2(-123.84)
     * @myAnnotationNumber3(123.456)
     * @myAnnotationArray(
     *     [
     *         'a' => 'b',
     *         'c' => 'c',
     *         [
     *             'd' => ['e', 'f']
     *         ]
     *     ]
     * )
     * @myAnnotationArray2(
     *     'a' => 'b',
     *     'c' => 'c',
     *     [
     *         'd' => ['e', 'f']
     *     ]
     * )
     * @var teste
     */
    private $mySampleProperty;

    /**
     * @myAnnotationBoolean(true)
     * @myAnnotationString('String name')
     * @myAnnotationString2(String name)
     * @myAnnotationNumber(123)
     * @myAnnotationNumber2(-123.84)
     * @myAnnotationNumber3(123.456)
     * @myAnnotationArray(
     *     [
     *         'a' => 'b',
     *         'c' => 'c',
     *         [
     *             'd' => ['e', 'f']
     *         ]
     *     ]
     * )
     * @myAnnotationArray2(
     *     'a' => 'b',
     *     'c' => 'c',
     *     [
     *         'd' => ['e', 'f']
     *     ]
     * )
     */
    public function mySampleMethod()
    {

    }
}

?>

Read Class Annotations

readClass('GSoares\Annotation\Sample\SampleClass');

$annotationBag->get('myAnnotationBoolean'); //(boolean) true
$annotationBag->get('myAnnotationString'); //(string) String name
$annotationBag->get('myAnnotationString2'); //(string) String name
$annotationBag->get('myAnnotationNumber'); //(int) 123
$annotationBag->get('myAnnotationNumber2'); //(int) -123.84
$annotationBag->get('myAnnotationNumber3'); //(float) 123.456
$annotationBag->get('myAnnotationArray'); //(Array) ['a' => 'b', 'c' => 'c', ['d' => ['e', 'f']]]
$annotationBag->get('myAnnotationArray2'); //(Array) ['a' => 'b', 'c' => 'c', ['d' => ['e', 'f']]]
?>

Read Class Property Annotations

readProperty(
    'GSoares\Annotation\Sample\SampleClass',
    'mySampleProperty'
);

$annotationBag->get('myAnnotationBoolean'); //(boolean) true
$annotationBag->get('myAnnotationString'); //(string) String name
$annotationBag->get('myAnnotationString2'); //(string) String name
$annotationBag->get('myAnnotationNumber'); //(int) 123
$annotationBag->get('myAnnotationNumber2'); //(int) -123.84
$annotationBag->get('myAnnotationNumber3'); //(float) 123.456
$annotationBag->get('myAnnotationArray'); //(Array) ['a' => 'b', 'c' => 'c', ['d' => ['e', 'f']]]
$annotationBag->get('myAnnotationArray2'); //(Array) ['a' => 'b', 'c' => 'c', ['d' => ['e', 'f']]]
?>

Read Class Method Annotations

readMethod(
    'GSoares\Annotation\Sample\SampleClass',
    'mySampleMethod'
);

$annotationBag->get('myAnnotationBoolean'); //(boolean) true
$annotationBag->get('myAnnotationString'); //(string) String name
$annotationBag->get('myAnnotationString2'); //(string) String name
$annotationBag->get('myAnnotationNumber'); //(int) 123
$annotationBag->get('myAnnotationNumber2'); //(int) -123.84
$annotationBag->get('myAnnotationNumber3'); //(float) 123.456
$annotationBag->get('myAnnotationArray'); //(Array) ['a' => 'b', 'c' => 'c', ['d' => ['e', 'f']]]
$annotationBag->get('myAnnotationArray2'); //(Array) ['a' => 'b', 'c' => 'c', ['d' => ['e', 'f']]]
?>

Installation

  1. Project available in https://packagist.org/packages/gabrielfs7/annotation to install via composer.

The Versions

27/10 2014

dev-master

9999999-dev

A PHP library to parse annotations

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Gabriel Felipe Soares

27/10 2014

1.0.0

1.0.0.0

A PHP library to parse annotations

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Gabriel Felipe Soares