https://github.com/oanhnn/laravel-fakeid
:+1: Easy fake model ID on URL Laravel 5.5+ Application
https://github.com/oanhnn/laravel-fakeid
hashids laravel laravel-5-package laravel-package
Last synced: 2 months ago
JSON representation
:+1: Easy fake model ID on URL Laravel 5.5+ Application
- Host: GitHub
- URL: https://github.com/oanhnn/laravel-fakeid
- Owner: oanhnn
- License: mit
- Created: 2018-10-06T11:21:58.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-14T05:09:54.000Z (over 5 years ago)
- Last Synced: 2025-07-19T15:15:04.334Z (3 months ago)
- Topics: hashids, laravel, laravel-5-package, laravel-package
- Language: PHP
- Homepage:
- Size: 59.6 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel FakeID
[](https://github.com/oanhnn/laravel-fakeid/actions)
[](https://coveralls.io/github/oanhnn/laravel-fakeid)
[](https://packagist.org/packages/oanhnn/laravel-fakeid)
[](https://packagist.org/packages/oanhnn/laravel-fakeid)
[](https://packagist.org/packages/oanhnn/laravel-fakeid)
[](LICENSE)Easy fake model ID on URL Laravel Application.
## Requirements
* php >=7.2
* Laravel 7.0+> Laravel 5.5+ using version 1.x (require php 7.1.3+)
## Installation
Begin by pulling in the package through Composer.
```bash
$ composer require oanhnn/laravel-fakeid
```Publish config file with
```bash
$ php artisan vendor:publish --provider="Laravel\\FakeId\\ServiceProvider"
```or
```bash
php artisan vendor:publish --tag=laravel-fakeid-config
```Edit `config/fakeid.php` for config specific drivers.
## Usage
### Getting start
In your model class, add implement interface `ShouldFakeId` and a trait `RoutesWithFakeId`:
```php
**Note** With each drivers, the input data format may be different, but the output data after decode is same with input
>
> | Driver | Input type | Encoded type | Decoded type |
> |-----------|------------|--------------|--------------|
> | base64 | string | string | string |
> | hashids | int[] | string | int[] |
> | hex | string | string | string |
> | optimus | int | int | int |
> | prefix | string | string | string |
> | chain | string | string | string |### Custom driver
You can also create custom driver by implements `Laravel\FakeId\Contracts\Driver` interface
```php
namespace App;
use Laravel\FakeId\Contracts\Driver;
class CustomDriver implements Driver
{
// your driver logic
}
```And register with FakeId Manager by add below code to `AppServiceProvider::boot()` method
```php
encode('123');```
## Changelog
See all change logs in [CHANGELOG](CHANGELOG.md)
## Testing
```bash
$ git clone git@github.com/oanhnn/laravel-fakeid.git /path
$ cd /path
$ composer install
$ composer test
```## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email to [Oanh Nguyen](mailto:oanhnn.bk@gmail.com) instead of
using the issue tracker.## Credits
- [Oanh Nguyen](https://github.com/oanhnn)
- [All Contributors](../../contributors)## License
This project is released under the MIT License.
Copyright © [Oanh Nguyen](https://oanhnn.github.io).