承接 faintshadow/routehelper 相关项目开发

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

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

faintshadow/routehelper

最新稳定版本:1.0.2

Composer 安装命令:

composer require faintshadow/routehelper

包简介

Generate a URL pattern for a named route with placeholder support.

README 文档

README

Generate a URL pattern for a named route with placeholder support.

This helper creates route URLs with placeholder templates that can be used for frontend JavaScript route generation. Placeholders MUST follow the format {name} where 'name' matches the route parameter name.

Examples:

Basic usage with placeholder:

$pattern = routeTemplate('company.item.destroy', [
    'company' => $company->id,
    'item' => '{item}'  // MUST use {item} format
]);
// Returns: "https://example.com/companies/123/items/{item}"

Usage with multiple placeholders:

$pattern = routeTemplate('company.department.employee.show', [
    'company' => '{company}',      // MUST use {company} format
    'department' => '{department}', // MUST use {department} format
    'employee' => '{employee}'      // MUST use {employee} format
]);

Mixed actual values and placeholders:

$pattern = routeTemplate('company.item.edit', [
    'company' => 456,        // Actual value
    'item' => '{item}'       // Placeholder - MUST use {item} format
]);
// Returns: "https://example.com/companies/456/items/{item}/edit"

Important:

All placeholder templates MUST follow the exact format {parameterName} where parameterName matches the route parameter. Incorrect formats like {{item}}, <item>, or ITEM_ID will not work.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2025-10-03