Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Replace your integer url params in Symfony applications and hide under unpredictable strings.

License

NotificationsYou must be signed in to change notification settings

PGSSoft/HashId

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PGS Software / HashId

PHP from PackagistBuild StatusCode CoverageScrutinizer Code Quality

Symfony bundle for encoding integer route parameters and decoding request parameters withhttp://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.yamlpgs_hash_id:converter:hashids:salt:'my super salt'min_hash_length:20alphabet:'qwertyasdzxc098765-'

Controller configuration

usePgs\HashIdBundle\Annotation\Hash;class UserControllerextends Controller{/**     * @Hash("id")     */publicfunctionedit(int$id)    {//...    }/**     * Process multiple parameters - 'oneMore' will not be processed     * @Route(name="test", path="/test/{id}/{other}/{oneMore}")     * @Hash({"id","other"})     */publicfunctiontest(int$id,int$other,int$oneMore)    {//...    }}

You can also check ourDemoController.

Contributing

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

About

The project maintained bysoftware development agencyPGS Software.See our otheropen-source projects orcontact us to develop your product.

Follow us

Twitter URLTwitter Follow


[8]ページ先頭

©2009-2025 Movatter.jp