Skip to content

Commit d75dc97

Browse files
committed
Initial Commit
Signed-off-by: Avior <github@avior.me>
0 parents  commit d75dc97

17 files changed

+2663
-0
lines changed

.devcontainer/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.159.0/containers/php/.devcontainer/base.Dockerfile
2+
3+
# [Choice] PHP version: 8, 8.0, 7, 7.4, 7.3
4+
ARG VARIANT="7.3"
5+
FROM mcr.microsoft.com/vscode/devcontainers/php:0-${VARIANT}
6+
7+
# [Option] Install Node.js
8+
ARG INSTALL_NODE="true"
9+
ARG NODE_VERSION="lts/*"
10+
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
11+
12+
# [Optional] Uncomment this section to install additional OS packages.
13+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
14+
# && apt-get -y install --no-install-recommends <your-package-list-here>
15+
16+
# [Optional] Uncomment this line to install global node packages.
17+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.159.0/containers/php
3+
{
4+
"name": "PHP",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Update VARIANT to pick a PHP version: 8, 8.0, 7, 7.4, 7.3
9+
"VARIANT": "7.3",
10+
"INSTALL_NODE": "false",
11+
"NODE_VERSION": "lts/*"
12+
}
13+
},
14+
15+
// Set *default* container specific settings.json values on container create.
16+
"settings": {
17+
"terminal.integrated.shell.linux": "/bin/bash",
18+
"php.validate.executablePath": "/usr/local/bin/php"
19+
},
20+
21+
// Add the IDs of extensions you want installed when the container is created.
22+
"extensions": [
23+
"felixfbecker.php-debug",
24+
"bmewburn.vscode-intelephense-client",
25+
"editorconfig.editorconfig"
26+
],
27+
28+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
29+
// "forwardPorts": [8080],
30+
31+
// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
32+
// "portsAttributes": {
33+
// "8000": {
34+
// "label": "Hello Remote World",
35+
// "onAutoForward": "notify"
36+
// }
37+
// },
38+
39+
// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
40+
// "otherPortsAttributes": {
41+
// "onAutoForward": "silent"
42+
// },
43+
44+
// Use 'postCreateCommand' to run commands after the container is created.
45+
// "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html"
46+
47+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
48+
"remoteUser": "vscode"
49+
}

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# TCGdex PHP SDK (WIP)
2+
3+
This is the SDK used to communicate with the Open source [TCGdex API](https://www.github.com/tcgdex/cards-database) trough PHP
4+
5+
Full API/SDK documentation in progress at https://www.tcgdex.net/docs
6+
7+
## Install
8+
9+
```bash
10+
composer require tcgdex/sdk
11+
# if you have no PSR 16/17/18 implementations add the following packages
12+
# they will be automaticly setup for the project
13+
# symfony/cache === PSR16
14+
# nyholm/psr7 === PSR17
15+
# kriswallsmith/buzz === PSR18
16+
composer require symfony/cache nyholm/psr7 kriswallsmith/buzz
17+
```
18+
19+
## Usage
20+
21+
_Note: a complete documentation is in progress_
22+
23+
```php
24+
use TCGdex\TCGdex;
25+
26+
// Is you are using your own PSRs implementations add theses before loading the class
27+
TCGdex::$cache = /* PSR16 CacheInterface */;
28+
TCGdex::$requestFactory = /* PSR17 RequestFactoryInterface */;
29+
TCGdex::$client = /* PSR18 ClientInterface */;
30+
31+
// initialize the SDK with the language
32+
$tcgdex = new TCGdex("en");
33+
34+
// Fetch you cards !
35+
$card = $tcgdex->fetchCard('1', 'Sword & Shield');
36+
```

composer.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "tcgdex/sdk",
3+
"description": "PHP SDK to communicate with the TCGdex API",
4+
"type": "library",
5+
"license": "MIT",
6+
"autoload": {
7+
"psr-4": {
8+
"TCGdex\\": "./src/"
9+
}
10+
},
11+
"authors": [
12+
{
13+
"name": "Avior",
14+
"email": "github@avior.me"
15+
}
16+
],
17+
"minimum-stability": "stable",
18+
"require": {
19+
"php": ">=7.3",
20+
"psr/http-client": "^1.0",
21+
"psr/simple-cache": "^1.0"
22+
},
23+
"suggest": {
24+
"kriswallsmith/buzz": "Good PSR 18 implementation",
25+
"nyholm/psr7": "Good PSR17 implementation",
26+
"symfony/cache": "Good PSR16 implementation"
27+
},
28+
"require-dev": {
29+
"kriswallsmith/buzz": "^1.2",
30+
"symfony/cache": "^5.3",
31+
"nyholm/psr7": "^1.4",
32+
"squizlabs/php_codesniffer": "^3.6",
33+
"phpmd/phpmd": "^2.10",
34+
"phpstan/phpstan": "^0.12.90"
35+
},
36+
"scripts": {
37+
"phpcs": "phpcs",
38+
"phpmd": "vendor/bin/phpmd src text phpmd",
39+
"phpstan": "phpstan analyse src --level=max"
40+
}
41+
}

0 commit comments

Comments
 (0)