Download the PHP package saeven/zf3-circlical-autowire without Composer

On this page you can find all versions of the php package saeven/zf3-circlical-autowire. 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 zf3-circlical-autowire

Route Auto-Wiring for Laminas-MVC

Build Status Codacy Badge Codacy Badge Total Downloads

A laminas-mvc module that favors rapid development, it does two things:

Older versions support zend-mvc, check releases.

Use annotations right above your actions to automatically plug routes into the ZF3 Router. No more gear-switching to route files, or digging through route config arrays when you are refactoring.

This module also provides a reflection-based abstract factory to automatically wire your controllers using their constructors. Just define your constructors (as you should) and let the lazy factory do the rest!

Installation

Install with:

composer require zf3-circlical-autowire

Then, add it near the top of your application.config.php

'CirclicalAutoWire',

Automatic Controller DI

Don't need to do anything. Excellently lazy, it's automatic. You can code Controllers, add dependencies to your constructor, and this module will inject classes from your service container right into your controller.

Automatic Routes

In any controller that should use this module, simply add this use statement:

use CirclicalAutoWire\Annotations\Route;

Method Annotations

On any action in a controller with the use statement, use these types of annotations:

<?php
/**
 * Your usual stuff here
 * @returns bool
 * @Route("/freedom")
 */
 public function anyOldNameAction(){
    // this beats editing a route file each time!
 }

/**
 * This route has a parameter
 * @Route("/freedom/:param")
 */
 public function anyOldNameAction(){
    $this->params()->fromRoute('param');
 }

/**
 * This route has a parameter and a constraint
 * @Route("/freedom/:param", constraints={"param":"[a-zA-Z]"})
 */
 public function anyOldNameAction(){
    // ...
 }

/**
 * Route with parameter, constraint, and defaults
 * @Route("/freedom/:param", constraints={"param":"[a-zA-Z]"}, defaults={"param":"index"})
 */
 public function anyOldNameAction(){
    // ...
 }

/**
 * Route with parameter, name, constraint, and defaults
 * @Route("/freedom/:param", name="easy-as-pie", constraints={"param":"[a-zA-Z]"}, defaults={"param":"index"})
 */
 public function anyOldNameAction(){
    // ...
 }

Child Routes

Child routes are simple to define. Define the parent by giving it a name, and whether or not it may terminate. Separately, tell the child routes that their parent is that first route (by way of name). Here's a complete example:

<?php
/**
 * Class ChildRouteController
 * @package Spec\CirclicalAutoWire\Controller
 */
class ChildRouteController extends AbstractActionController
{

    /**
     * @Route("/icecream", name="icecream", terminate=true)
     */
    public function indexAction(){}

    /**
     * This is a sample docblock
     *
     * @Route("/eat", parent="icecream", name="eat")
     */
    public function eatAction(){}

    /**
     * @Route("/select/:flavor", constraints={"flavor":"\d"}, name="select", parent="icecream")
     */
    public function selectFlavorAction(){}

}

This will produce:

<?php
'router' => [
    'routes' => [
        'icecream' => [
            'type' => Literal::class,
            'options' => [
                'route' => '/icecream',
                'defaults' => [
                    'controller' => ChildRouteController::class,
                    'action' => 'index',
                ],
            ],
            'may_terminate' => true,
            'child_routes' => [
                'eat' => [
                    'type' => Literal::class,
                    'options' => [
                        'route' => "/eat",
                        'defaults' => [
                            'controller' => ChildRouteController::class,
                            'action' => 'eat',
                        ],
                    ],
                ],
                'select' => [
                    'type' => Segment::class,
                    'options' => [
                        'route' => "/select/:flavor",
                        'defaults' => [
                            'controller' => ChildRouteController::class,
                            'action' => 'selectFlavor',
                        ],
                        'constraints' => [
                            'flavor' => '\d',
                        ],
                    ],
                ],
            ],
        ],
    ],
],

Controller Annotations

Provided as a convenience, these help you reach a higher level of lazy. If you know all your Controller routes will start with /index/system, simply annotate your controller as such:

<?php
/**
 * Controller Index
 * @Route("/index/system")
 */
 class IndexController extends AbstractActionController
 {

     /**
      * @Route("/update")
      */
     public function updateAction(){

     }

     /**
      * @Route("/get/:id")
      */
     public function getAction(){

     }
 }

In the example above, the following routes will be compiled:

Two Modes

Mode is set, via config.

Development

In this mode, annotations are scanned and read. There's an incredibly small overhead to scanning Controller code. Each time you refresh, you will see the compiled routes file recreated in the location you have specified (see this Module's config file).

Production

In this mode, annotations are not scanned. Instead, the config file you created in dev mode is automatically merged with your Zend Framework's routes/route config to create a 'traditional' scenario where routes are hardcoded. Zero module overhead.

Important Note: When actuated via the console, it will behave as though it were in production mode

I hope you like this module, you can reach out on freenode's #zftalk or @Saeven on Twitter! All PRs considered!


All versions of zf3-circlical-autowire with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 | >=8
laminas/laminas-mvc Version ^3.0.1 | ^3.2.0
laminas/laminas-servicemanager Version ^3.0.1 | ^3.6.4
laminas/laminas-eventmanager Version ^3.0.1 | ^3.3.1
laminas/laminas-router Version @stable
laminas/laminas-code Version 3.5.1
laminas/laminas-config Version @stable
laminas/laminas-cli Version @stable
doctrine/annotations Version @stable
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 saeven/zf3-circlical-autowire contains the following files

Loading the files please wait ....