- Notifications
You must be signed in to change notification settings - Fork3
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
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
composer require pgs-soft/hashid-bundle
# config/packages/pgs_hash_id.yamlpgs_hash_id:converter:hashids:salt:'my super salt'min_hash_length:20alphabet:'qwertyasdzxc098765-'
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.
Bug reports and pull requests are welcome on GitHub athttps://github.com/PGSSoft/HashId.
The project maintained bysoftware development agencyPGS Software.See our otheropen-source projects orcontact us to develop your product.
About
Replace your integer url params in Symfony applications and hide under unpredictable strings.
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published