Download the PHP package sageit/phalcon-micro-annotations without Composer
On this page you can find all versions of the php package sageit/phalcon-micro-annotations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sageit/phalcon-micro-annotations
More information about sageit/phalcon-micro-annotations
Files in sageit/phalcon-micro-annotations
Package phalcon-micro-annotations
Short Description Sage IT Component for Phalcon - Annotations Parser for annotation routes
License MIT
Informations about the package phalcon-micro-annotations
Phalcon Micro-Annotation [![Latest Stable Version](http://poser.pugx.org/sageit/phalcon-micro-annotations/v?style=plastic)](https://packagist.org/packages/sageit/phalcon-micro-annotations) [![Total Downloads](http://poser.pugx.org/sageit/phalcon-micro-annotations/downloads?style=plastic)](https://packagist.org/packages/sageit/phalcon-micro-annotations) [![License](http://poser.pugx.org/sageit/phalcon-micro-annotations/license?style=plastic)](https://packagist.org/packages/sageit/phalcon-micro-annotations) [![PHP Version Require](http://poser.pugx.org/sageit/phalcon-micro-annotations/require/php?style=plastic)](https://packagist.org/packages/sageit/phalcon-micro-annotations) [![Phalcon Version](https://img.shields.io/packagist/dependency-v/sageit/phalcon-micro-annotations/ext-phalcon?label=Phalcon&logo=Phalcon%20Version&style=plastic)](https://packagist.org/packages/sageit/phalcon-micro-annotations)
Allows you to use annotations for routing on Phalcon Micro Applications. While the built in Phalcon class for an annotation based router works on full suite Phalcon apps, Micro uses a different mounting methodology and does not support this. The Micro-Annotation Router leverages the build in Micro mounting method while allowing for annotation parsing with the caching method of your choice.
**[Explore the docs »](https://github.com/SageITSolutions/phalcon-micro-annotations)** **[Report Bug](https://github.com/SageITSolutions/phalcon-micro-annotations/issues)** · **[Request Feature](https://github.com/SageITSolutions/phalcon-micro-annotations/issues)**Table of Contents
- About the Project
- Installation
- Usage
- Caching
- Roadmap
- Contributing
- License
- Contact
- Acknowledgements
About The Project
Built With
Installation
Git:
Composer:
Usage
This project consists of an included Router class extension which follows closely to the Phalcon 5 Namespace convention. Once a service is added in the micro app, this can easily be leveraged.
Create a Service (Example)
When creating the service, MicroRouter requires 2 parameters.
- The Dependancy Injector the service is added to.
- An Object containing optional settings.
The provided example demonstrates the default values assumed if the option is ommited.
Mount Micro to the service
From within the Micro class call:
this will pass the micro app ($this
) to the parsor and call the micro mount method using the parsed annotions
Caching
This class supports safeguarded Caching. You can choose between APCu
, Stream
, or Memory
(Not Caching) when creating the router service to optimize usage.
Specifying Cache Method
Within the Options array passed to the MicroRouter, specify the adapter of choice.
APCu
APCu
Memory
technically, Memory
is the fallback when all others fail, so any value not APCU or Stream would resolve to memory
Safeguards
Once specified, the class checks for the presence of the required components before using a caching method. This works in a tiered manner.
APCu
is specified, checks are made if APCu is installed and enabled, if not the adapter will revert to StreamStream
is specified (or APCu specification failed), checks are made that the directory specified forcachedirectory
exists, if not adapter will revert to MemoryMemory
is specified (or result of reverting), no checks are required, all parsing is done in memory each time.
Parsing
When caching methods are enabled, they are processed first before iterating files producing I/O calls. If annotations are present, no files are parsed, and routes are generated from memory. When no annotations are present (first call or after clearing cache) then Controller files are parsed from the provided directory
and annotations are added.
Clearing Cache
A public utility method is included to facilitate the need to rebuild the cache either in testing or publishing scenarios. Clearing Cache is dependant on the adapter specified.
From within the micro class
This will remove all APCu entries with the prefix _phan
or removing all files in the cachedirectory
depending on the adaptor type.
if the dependancy injector identifies as logger
service, the notices are logged indicating the cleared cache
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Sage IT Solutions - Email
Project Link: https://github.com/SageITSolutions/phalcon-micro-annotations
Acknowledgements
All versions of phalcon-micro-annotations with dependencies
ext-phalcon Version 4.* || 5.*