Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Signed-off-by: Avior <[email protected]>
  • Loading branch information
Aviortheking committed Jun 21, 2021
0 parents commit d75dc97
Show file tree
Hide file tree
Showing 17 changed files with 2,663 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.159.0/containers/php/.devcontainer/base.Dockerfile

# [Choice] PHP version: 8, 8.0, 7, 7.4, 7.3
ARG VARIANT="7.3"
FROM mcr.microsoft.com/vscode/devcontainers/php:0-${VARIANT}

# [Option] Install Node.js
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
49 changes: 49 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.159.0/containers/php
{
"name": "PHP",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update VARIANT to pick a PHP version: 8, 8.0, 7, 7.4, 7.3
"VARIANT": "7.3",
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"php.validate.executablePath": "/usr/local/bin/php"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"felixfbecker.php-debug",
"bmewburn.vscode-intelephense-client",
"editorconfig.editorconfig"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [8080],

// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
// "portsAttributes": {
// "8000": {
// "label": "Hello Remote World",
// "onAutoForward": "notify"
// }
// },

// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
// "otherPortsAttributes": {
// "onAutoForward": "silent"
// },

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html"

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# TCGdex PHP SDK (WIP)

This is the SDK used to communicate with the Open source [TCGdex API](https://www.github.com/tcgdex/cards-database) trough PHP

Full API/SDK documentation in progress at https://www.tcgdex.net/docs

## Install

```bash
composer require tcgdex/sdk
# if you have no PSR 16/17/18 implementations add the following packages
# they will be automaticly setup for the project
# symfony/cache === PSR16
# nyholm/psr7 === PSR17
# kriswallsmith/buzz === PSR18
composer require symfony/cache nyholm/psr7 kriswallsmith/buzz
```

## Usage

_Note: a complete documentation is in progress_

```php
use TCGdex\TCGdex;

// Is you are using your own PSRs implementations add theses before loading the class
TCGdex::$cache = /* PSR16 CacheInterface */;
TCGdex::$requestFactory = /* PSR17 RequestFactoryInterface */;
TCGdex::$client = /* PSR18 ClientInterface */;

// initialize the SDK with the language
$tcgdex = new TCGdex("en");

// Fetch you cards !
$card = $tcgdex->fetchCard('1', 'Sword & Shield');
```
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "tcgdex/sdk",
"description": "PHP SDK to communicate with the TCGdex API",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"TCGdex\\": "./src/"
}
},
"authors": [
{
"name": "Avior",
"email": "[email protected]"
}
],
"minimum-stability": "stable",
"require": {
"php": ">=7.3",
"psr/http-client": "^1.0",
"psr/simple-cache": "^1.0"
},
"suggest": {
"kriswallsmith/buzz": "Good PSR 18 implementation",
"nyholm/psr7": "Good PSR17 implementation",
"symfony/cache": "Good PSR16 implementation"
},
"require-dev": {
"kriswallsmith/buzz": "^1.2",
"symfony/cache": "^5.3",
"nyholm/psr7": "^1.4",
"squizlabs/php_codesniffer": "^3.6",
"phpmd/phpmd": "^2.10",
"phpstan/phpstan": "^0.12.90"
},
"scripts": {
"phpcs": "phpcs",
"phpmd": "vendor/bin/phpmd src text phpmd",
"phpstan": "phpstan analyse src --level=max"
}
}
Loading

0 comments on commit d75dc97

Please sign in to comment.