Download the PHP package minime/annotations without Composer

On this page you can find all versions of the php package minime/annotations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package annotations

Minime \ Annotations

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version Total Downloads Reference Status License SensioLabsInsight

Minime\Annotations is the first KISS PHP annotations library.

Composer Installation

Through terminal: composer require minime/annotations:~3.0 :8ball:

Setup

First grab an instance of the Minime\Annotations\Reader the lazy way:

Or instantiate the annotations reader yourself with:

Notice that Reader::createFromDefaults() creates a reader instance with array cache enabled. On production you might want to use a persistent cache handler like FileCache instead:

Reading Annotations

Consider the following class with some docblock annotations:

Let's use the Minime\Annotations\Reader instance to read annotations from classes, properties and methods. Like so:

The same applies to class properties...

methods...

and functions || closures:

Managing Annotations

The annotations reader Reader::get(*)Annotations always returns AnnotationsBag instances so you can easily manage annotations:

Namespacing

It's a good idea to namespace custom annotations that belong to a package. Later you can retrieve all those namespaced annotations using the AnnotationsBag api:

Piping Filters

You can also easily "pipe" filters. This time let's "grep" all annotations beginning with "x" and within "response" namespace:

Traversing results

As you might expect, AnnotationsBag is traversable too:

Union

You can also perform union operations between two annotations sets:

Please refer to annotations bag public API for more operations.

The Default Syntax

@(<namespace><namespace-delimiter>)?<annotation-identifier> <type>? <value>?

Which basically means that:

Some valid examples below:

Concrete Annotations

Sometimes you need your annotations to encapsulate logic and you can only do it by mapping instructions to formal PHP classes. These kind of "concrete" typed annotations can be declared with the -> (arrow symbol):

In the example above: when prompted, the annotation parser will instantiate a new \Model\Field\Validation() following the declared JSON prototype { "rules" : {...} }. Voilà! Instantly classy annotations.

Caching

This package comes with two basic cache handlers. ArrayCache (for testing) and a very simple FileCache handler for persistence. Cache handlers can be set during Minime\Annotations\Reader instantiation:

Or later with Reader::setCache():

Public API

Minime\Annotations\Reader

::getClassAnnotations($subject)

Get all annotations from a given class:

::getPropertyAnnotations($subject, $propertyName)

Get all annotations from a given class property:

::getMethodAnnotations($subject, $methodName)

Get all annotations from a given class method:

::getFunctionAnnotations($fn)

Get all annotations from a given full qualified function name or closure:

::getCache()

::setCache(CacheInterface $cache)

::getParser()

::setParser(ParserInterface $cache)

Minime\Annotations\AnnotationsBag

::grep($pattern)

Filters annotations using a valid regular expression and returns a new AnnotationBag with the matching results.

::useNamespace($pattern)

Isolates a given namespace of annotations. Basically this method filters annotations by a namespace and returns a new AnnotationBag with simplified annotations identifiers.

::union(AnnotationsBag $bag)

Performs union operation with a subject AnnotationBag:

::toArray()

::get($key, $default = null)

::getAsArray($key)

::has($key)

::set($key, $value)

::count

Minime\Annotations\Cache\FileCache

::__construct($storagePath = null)

See example in context with Minime\Annotations\Reader:

If no path is given OS tmp dir is assumed as cache storage path.

::clear()

Clears entire cache. See example in context with Minime\Annotations\Reader:

Minime\Annotations\Cache\ArrayCache

::clear()

Clears entire cache. See example in context with Minime\Annotations\Reader:

Contributions

Found a bug? Have an improvement? Take a look at the issues.

Guide

  1. Fork minime\annotations
  2. Clone forked repository
  3. Install composer dependencies $ composer install
  4. Run unit tests $ phpunit
  5. Modify code: correct bug, implement features
  6. Back to step 4

Copyright

Copyright (c) 2013-2014 Márcio Almada. Distributed under the terms of an MIT-style license. See LICENSE for details.


All versions of annotations with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ext-json Version *
regex-guard/regex-guard Version ~1.0
nikic/php-parser Version >=2.0 <4.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package minime/annotations contains the following files

Loading the files please wait ....