├── .github └── dependabot.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── composer.json └── src ├── Identicon.php ├── IdenticonFacade.php └── IdenticonServiceProvider.php /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: composer 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "23:30" 8 | open-pull-requests-limit: 10 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.phar 3 | composer.lock 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to make participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at `syed at lukonet.com`. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | Please read and understand the contribution guide before creating an issue or pull request. 6 | 7 | ## Etiquette 8 | 9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code 10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be 11 | extremely unfair for them to suffer abuse or anger for their hard work. 12 | 13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the 14 | world that developers are civilized and selfless people. 15 | 16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient 17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 18 | 19 | ## Viability 20 | 21 | When requesting or submitting new features, first consider whether it might be useful to others. Open 22 | source projects are used by many developers, who may have entirely different needs to your own. Think about 23 | whether or not your feature is likely to be used by other users of the project. 24 | 25 | ## Procedure 26 | 27 | Before filing an issue: 28 | 29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 30 | - Check to make sure your feature suggestion isn't already present within the project. 31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 32 | - Check the pull requests tab to ensure that the feature isn't already in progress. 33 | 34 | Before submitting a pull request: 35 | 36 | - Check the codebase to ensure that your feature doesn't already exist. 37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 38 | 39 | ## Requirements 40 | 41 | If the project maintainer has any additional requirements, you will find them listed here. 42 | 43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). 44 | 45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 46 | 47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 48 | 49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 50 | 51 | - **Create feature branches** - Don't ask us to pull from your master branch. 52 | 53 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 54 | 55 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 56 | 57 | 58 | ## Running Tests 59 | 60 | ``` bash 61 | $ composer test 62 | ``` 63 | 64 | **Happy coding**! 65 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2014-20 Syed I.R. 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Laravel-Identicon Package 2 | ========================= 3 | [![Join PHP Chat][ico-phpchat]][link-phpchat] 4 | [![Chat on Telegram][ico-telegram]][link-telegram] 5 | [![Laravel Package][ico-laravel]][link-repo] 6 | [![Latest Version on Packagist][ico-version]][link-packagist] 7 | [![Software License][ico-license]](LICENSE.md) 8 | [![Total Downloads][ico-downloads]][link-downloads] 9 | 10 | > Laravel [Identicon][link-identicon] Package - Extends Identicon Library and Adds Support for Seamless Usage with Laravel. 11 | 12 | ## Quick start 13 | 14 | 15 | ### Installation 16 | 17 | ```bash 18 | $ composer require irazasyed/laravel-identicon 19 | ``` 20 | 21 | ## Usage 22 | 23 | This Package adds Laravel Support to [Identicon][link-identicon] PHP Library. It simply extends the library as well as optimized for usage with Laravel. So all the methods listed [here][link-identicon] are available and will work seamlessly. 24 | 25 | ### Example Methods 26 | 27 | Generate and Display an identicon image: 28 | 29 | ```php 30 | Identicon::displayImage('foo'); 31 | ``` 32 | 33 | Generate and get the image data 34 | 35 | ```php 36 | $imageData = Identicon::getImageData('bar'); 37 | ``` 38 | 39 | Generate and get the base 64 image uri ready for integrate into an HTML img tag. The below example is using blade templating 40 | 41 | ``` 42 | bar Identicon 43 | ``` 44 | 45 | ... 46 | 47 | And all the other remaining methods from the main library. 48 | 49 | ## Contributing 50 | 51 | Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details. 52 | 53 | ## Security 54 | 55 | If you discover any security related issues, please email `syed at lukonet.com` instead of using the issue tracker. 56 | 57 | ## Credits 58 | 59 | - [Syed][link-author] 60 | - [All Contributors][link-contributors] 61 | 62 | ## License 63 | 64 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 65 | 66 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Firazasyed%2Flaravel-identicon.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Firazasyed%2Flaravel-identicon?ref=badge_large) 67 | 68 | [ico-phpchat]: https://img.shields.io/badge/Slack-PHP%20Chat-5c6aaa.svg?style=flat-square&logo=slack&labelColor=4A154B 69 | [ico-telegram]: https://img.shields.io/badge/@PHPChatCo-2CA5E0.svg?style=flat-square&logo=telegram&label=Telegram 70 | [ico-laravel]: https://img.shields.io/badge/Laravel-6~8-FF2D20.svg?style=flat-square&logo=laravel&labelColor=black&logoColor=white 71 | [ico-version]: https://img.shields.io/packagist/v/irazasyed/laravel-identicon.svg?style=flat-square 72 | [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square 73 | [ico-downloads]: https://img.shields.io/packagist/dt/irazasyed/laravel-identicon.svg?style=flat-square 74 | 75 | [link-phpchat]: https://phpchat.co/?ref=laravel-identicon 76 | [link-telegram]: https://t.me/PHPChatCo 77 | [link-repo]: https://github.com/irazasyed/laravel-identicon 78 | [link-packagist]: https://packagist.org/packages/irazasyed/laravel-identicon 79 | [link-downloads]: https://packagist.org/packages/irazasyed/laravel-identicon 80 | [link-author]: https://github.com/irazasyed 81 | [link-contributors]: ../../contributors 82 | [link-identicon]: https://github.com/yzalis/Identicon 83 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "irazasyed/laravel-identicon", 3 | "description": "Laravel Identicon Package", 4 | "keywords": ["identicon", "avatar", "image", "laravel identicon", "laravel"], 5 | "homepage": "https://irazasyed.github.io/laravel-identicon/", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Syed I.R", 10 | "email": "syed@lukonet.com" 11 | } 12 | ], 13 | "require": { 14 | "php": "^7.2 || ^8.0", 15 | "illuminate/support": "^12.1.0", 16 | "yzalis/identicon": "^2.0" 17 | }, 18 | "autoload": { 19 | "psr-4": { 20 | "Irazasyed\\LaravelIdenticon\\": "src/" 21 | } 22 | }, 23 | "extra": { 24 | "laravel": { 25 | "providers": [ 26 | "Irazasyed\\LaravelIdenticon\\IdenticonServiceProvider" 27 | ], 28 | "aliases": { 29 | "Identicon": "Irazasyed\\LaravelIdenticon\\IdenticonFacade" 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Identicon.php: -------------------------------------------------------------------------------- 1 | getImageData($string, $size, $color, $backgroundColor); 22 | 23 | return Response::make($imageData, 200, ['Content-Type' => 'image/png']); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/IdenticonFacade.php: -------------------------------------------------------------------------------- 1 | app->singleton(Identicon::class, function ($app) { 18 | return new Identicon(); 19 | }); 20 | } 21 | 22 | /** 23 | * Get the services provided by the provider. 24 | * 25 | * @return array 26 | */ 27 | public function provides() 28 | { 29 | return [Identicon::class]; 30 | } 31 | } 32 | --------------------------------------------------------------------------------