Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vectorface/cc-icons
Generates an image based on a list of supported credit card types
https://github.com/vectorface/cc-icons
Last synced: about 1 month ago
JSON representation
Generates an image based on a list of supported credit card types
- Host: GitHub
- URL: https://github.com/vectorface/cc-icons
- Owner: Vectorface
- License: mit
- Created: 2020-10-16T16:43:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-10T21:53:21.000Z (about 1 year ago)
- Last Synced: 2024-12-20T16:52:31.764Z (about 2 months ago)
- Language: PHP
- Size: 581 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CC Icons
This is a PHP class that generates an image based on a
list of supported credit card or cryptocurrency types.
It makes it easy to get an image showing all supported
payment types for a payment processor.## Installation
Run the following [composer](https://getcomposer.org/) command:
```shell script
$ composer require vectorface/cc-icons
```## Using CC Icons
To create an image, create a new CCImageMaker object and
specify which icons to include.```php
use Vectorface\CCIcons\CCImageMaker;(new CCImageMaker)
->withTypes(["Visa", "Mastercard"])
->getDataUri();
```This will return the data URI (RFC 2397) string corresponding
to the image that was created. By default, each image is
300x200, transparent, and includes 10px padding between icons.## Methods
- `withTypes(array $processors)` - Specify which icons to include in the image
- `withPadding(int $new_padding)` - Specify how much padding to include between icons
- `withSize(int $width, int $height)` - Specify the size of the output image
- `withLayout(array $override)` - Override one or more default layouts
- `saveToDisk(string $path)` - Generate and save the image to the given location on disk
- `getDataUri()` - Generate and get the RFC 2397 string corresponding to the image## List of Supported Icons
Icons should be specified as a single word, case-insensitive
- Credit Cards:
- `AMEX`
- `Dankort`
- `DinersClub`
- `Discover`
- `JCB`
- `Maestro` -- Aliases: `Switch`, `Solo`
- `Mastercard` -- Alias: `MC`
- `PostePay`
- `UnionPay`
- `Visa` -- Aliases: `Delta`, `UKE`
- Cryptocurrencies:
- `BTC` (Bitcoin)
- `LTC` (Litecoin)
- `BCH` (Bitcoin Cash)
- `BNB` (Binance Coin)
- `ETH` (Ethereum)
- `USDT` (Tether)
- `USDC` (USD Coin)## Default Layouts
Layouts specify number of icons per row.
```php
[
1 => [1],
2 => [2],
3 => [2, 1],
4 => [2, 2],
5 => [3, 2],
6 => [3, 3],
]
```