Download the PHP package sunsgne/annotations without Composer

On this page you can find all versions of the php package sunsgne/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

sunsgne

sunsgne/annotation

🐬 Webman's shortcut routing based on annotation scheme 🐬

[![Latest Stable Version](http://poser.pugx.org/sunsgne/annotations/v)](https://packagist.org/packages/sunsgne/annotations) [![Total Downloads](http://poser.pugx.org/sunsgne/annotations/downloads)](https://packagist.org/packages/sunsgne/annotations) [![Latest Unstable Version](http://poser.pugx.org/sunsgne/annotations/v/unstable)](https://packagist.org/packages/sunsgne/annotations) [![License](http://poser.pugx.org/sunsgne/annotations/license)](https://packagist.org/packages/sunsgne/annotations) [![PHP Version Require](http://poser.pugx.org/sunsgne/annotations/require/php)](https://packagist.org/packages/sunsgne/annotations)

webman annotation 注解路由

使用了 doctrine/annotations 包来对代码内的注解进行解析。支持php8注解方式

您可以直接在控制器类任意方法定义@RequestMapping注解来完成一个路由的定义,如需使用路由中间件请定义该路由的注解方法@Middwares@Middware 注解并引入中间件命名空间即可

贡献者

  • 朱秋雨
  • 2023-3

更新日志

2.0.0 - 2023-11-21

1.1.2 - 2022-07-04

安装

使用

路由控制

路由中间件

在通过注解定义路由时,您仅可通过注解的方式来定义中间件,对中间件的定义有两个注解,分别为:

使用 @Middleware 注解时需 use Sunsgne\Annotations\Mapping\Middleware; 命名空间;

使用 @Middlewares 注解时需 use Sunsgne\Annotations\Mapping\Middlewares; 命名空间;

  • @Middleware 注解为定义单个中间件时使用,在一个地方仅可定义一个该注解,不可重复定义
  • @Middlewares 注解为定义多个中间件时使用,在一个地方仅可定义一个该注解,然后通过在该注解内定义多个 @Middleware 注解实现多个中间件的定义 定义单个中间件:
    
    use Sunsgne\Annotations\Mapping\RequestMapping;
    use Sunsgne\Annotations\Mapping\Middleware;
    use Sunsgne\Annotations\Mapping\Middlewares;
    use app\middleware\App;
    use app\middleware\Log;
    /**
  • @RequestMapping(methods="GET" , path="/api/json")
  • @Middleware(App::class)
  • @param Request $request
  • @return Response */ public function json(Request $request) { return json(['code' => 0, 'msg' => 'ok']); }

定义多个中间件:

use Sunsgne\Annotations\Mapping\RequestMapping;
use Sunsgne\Annotations\Mapping\Middleware;
use Sunsgne\Annotations\Mapping\Middlewares;
use app\middleware\App;
use app\middleware\Log;
/**
 * @RequestMapping(methods="GET" , path="/api/json")
 * @Middlewares({
 *     @Middleware(App::class),
 *     @Middleware(Log::class)
 * })
 * @param Request $request
 * @return Response
 */
public function json(Request $request)
{
    return json(['code' => 0, 'msg' => 'ok']);
}

支持PHP8.0+版本


*注意请勿直接copy。示例中未创建中间件

  1. 定义路由

    use Sunsgne\Annotations\Mapping\RequestMapping;
    use Sunsgne\Annotations\Mapping\Middleware;
    use Sunsgne\Annotations\Mapping\Middlewares;
    use app\middleware\App;
    use app\middleware\Log;
    #[RequestMapping(methods: "GET , POST" , path:"/api/json")]
    public function json(Request $request)
    {
    return json(['code' => 0, 'msg' => 'ok']);
    }
  2. 定义路由并配置中间件(多个)
    use Sunsgne\Annotations\Mapping\RequestMapping;
    use Sunsgne\Annotations\Mapping\Middleware;
    use Sunsgne\Annotations\Mapping\Middlewares;
    use app\middleware\App;
    use app\middleware\Log;
    #[RequestMapping(methods: "GET , POST" , path:"/api/json") , Middlewares(App::class , Log::class)]
    public function json(Request $request)
    {
    return json(['code' => 0, 'msg' => 'ok']);
    }

    忽略注解参数

请在config/plugin/sunsgne/annotations/ignored文件中添加需要忽略的参数

return [
    "after", "afterClass", "backupGlobals", "backupStaticAttributes", "before", "beforeClass", "codeCoverageIgnore*",
    "covers", "coversDefaultClass", "coversNothing", "dataProvider", "depends", "doesNotPerformAssertions",
    "expectedException", "expectedExceptionCode", "expectedExceptionMessage", "expectedExceptionMessageRegExp", "group",
    "large", "medium", "preserveGlobalState", "requires", "runTestsInSeparateProcesses", "runInSeparateProcess", "small",
    "test", "testdox", "testWith", "ticket", "uses" , "datetime" 
    // ........
];

All versions of annotations with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
doctrine/annotations Version ^1.13
ext-mbstring Version *
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 sunsgne/annotations contains the following files

Loading the files please wait ....