承接 jfm/simple-mvc-route-attributes-package 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jfm/simple-mvc-route-attributes-package

最新稳定版本:v1.0.1

Composer 安装命令:

composer require jfm/simple-mvc-route-attributes-package

包简介

A little package for the pedagogical PHP MVC framework owned by Wild Code School. Used for educational purpose only

README 文档

README

Description

This package is for the Wild Code School Simple MVC project. It allows to add attributes on all the Controller methods to define the route.

Installation

composer require jfm/simple-mvc-route-attributes

After the installation, you need to replace the all content of the src/routing.php file with the following:

<?php

use Jfm\SimpleMvcRouteAttributesPackage\Routing\RouteLoader;

RouteLoader::getInstance()->loadRoutes();

Usage

You can now use the #[Route] attribute on all your Controller methods to define the route.

<?php

namespace App\Controller;

use JFM\SimpleMVCRouteAttributes\Route;

class HomeController extends AbstractController
{
    #[Route('/')]
    public function index()
    {
        // ...
    }
// ...
}
<?php

namespace App\Controller;

use JFM\SimpleMVCRouteAttributes\Route;

class ItemController extends AbstractController
{
    #[Route('/items')]
    public function index()
    {
        // ...
    }

    #[Route('/items/show')]
    public function show()
    {
        // ...
    }
// ...
}

That's it!

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-18