承接 pgs-soft/hashid-bundle 相关项目开发

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

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

pgs-soft/hashid-bundle

Composer 安装命令:

composer require pgs-soft/hashid-bundle

包简介

Symfony Hash Id

README 文档

README

PHP from Packagist Build Status Code Coverage Scrutinizer Code Quality

Symfony bundle for encoding integer route parameters and decoding request parameters with http://www.hashids.org/

Please use this version with Symfony ≥5.0

Replace predictable integer url parameters in easy way:

  • /hash-id/demo/decode/216/30 => /hash-id/demo/decode/X46dBNxd79/30
  • /order/315 => /order/4w9aA11avM

Pros:

  • no need to use extra filters - use {{ url('route_name', {'id': 1}) }} in twig template or $this->generateUrl('route_name', ['id' => 1]); in controller or service
  • Doctrine Converter compatible

Instalation

composer require pgs-soft/hashid-bundle 

Hashids configuration

# config/packages/pgs_hash_id.yaml

pgs_hash_id:
    converter:
        hashids:
            salt: 'my super salt'
            min_hash_length: 20
            alphabet: 'qwertyasdzxc098765-'

Controller configuration

use Pgs\HashIdBundle\Annotation\Hash;

class UserController extends Controller
{
    /**
     * @Hash("id")
     */
    public function edit(int $id)
    {
    //...
    }
    
    /**
     * Process multiple parameters - 'oneMore' will not be processed
     * @Route(name="test", path="/test/{id}/{other}/{oneMore}")
     * @Hash({"id","other"})
     */
    public function test(int $id, int $other, int $oneMore)
    {
    //...
    }
}

You can also check our DemoController.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/PGSSoft/HashId.

About

The project maintained by software development agency PGS Software. See our other open-source projects or contact us to develop your product.

Follow us

Twitter URL Twitter Follow

统计信息

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

GitHub 信息

  • Stars: 13
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固