add qrcode lib

This commit is contained in:
Roland Schneider 2022-02-06 00:04:34 +01:00
parent 9856411844
commit 525a829da3
6 changed files with 433 additions and 194 deletions

View File

@ -35,7 +35,7 @@
"yiisoft/yii2-composer": "2.0.4", "yiisoft/yii2-composer": "2.0.4",
"sizeg/yii2-jwt": "^2.0", "sizeg/yii2-jwt": "^2.0",
"fxp/composer-asset-plugin": "dev-master", "fxp/composer-asset-plugin": "dev-master",
"ext-http": "*" "endroid/qr-code": "^2.5"
}, },
"require-dev": { "require-dev": {
"yiisoft/yii2-codeception": "*", "yiisoft/yii2-codeception": "*",

390
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "62617dd27b81a8c6428c875f01cf0dd8", "content-hash": "d1d630cf85ac72b3cb7d161afee070fe",
"packages": [ "packages": [
{ {
"name": "2amigos/yii2-tinymce-widget", "name": "2amigos/yii2-tinymce-widget",
@ -106,6 +106,52 @@
], ],
"time": "2015-10-23T14:50:49+00:00" "time": "2015-10-23T14:50:49+00:00"
}, },
{
"name": "bacon/bacon-qr-code",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
"reference": "5a91b62b9d37cee635bbf8d553f4546057250bee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee",
"reference": "5a91b62b9d37cee635bbf8d553f4546057250bee",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": "^5.4|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
},
"suggest": {
"ext-gd": "to generate QR code images"
},
"type": "library",
"autoload": {
"psr-0": {
"BaconQrCode": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Ben Scholzen 'DASPRiD'",
"email": "mail@dasprids.de",
"homepage": "http://www.dasprids.de",
"role": "Developer"
}
],
"description": "BaconQrCode is a QR code generator for PHP.",
"homepage": "https://github.com/Bacon/BaconQrCode",
"time": "2017-10-17T09:59:25+00:00"
},
{ {
"name": "bassjobsen/bootstrap-3-typeahead", "name": "bassjobsen/bootstrap-3-typeahead",
"version": "v4.0.0", "version": "v4.0.0",
@ -703,6 +749,75 @@
], ],
"time": "2015-11-06T10:35:36+00:00" "time": "2015-11-06T10:35:36+00:00"
}, },
{
"name": "endroid/qr-code",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/endroid/qr-code.git",
"reference": "6062677d3404e0ded40647b8f62ec55ff9722eb7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/endroid/qr-code/zipball/6062677d3404e0ded40647b8f62ec55ff9722eb7",
"reference": "6062677d3404e0ded40647b8f62ec55ff9722eb7",
"shasum": ""
},
"require": {
"bacon/bacon-qr-code": "^1.0.3",
"ext-gd": "*",
"khanamiryan/qrcode-detector-decoder": "1",
"myclabs/php-enum": "^1.5",
"php": ">=5.6",
"symfony/options-resolver": "^2.7",
"symfony/property-access": "^2.7"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"symfony/asset": "^2.7",
"symfony/browser-kit": "^2.7",
"symfony/finder": "^2.7",
"symfony/framework-bundle": "^2.7",
"symfony/http-kernel": "^2.7",
"symfony/templating": "^2.7",
"symfony/twig-bundle": "^2.7",
"symfony/yaml": "^2.7"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"Endroid\\QrCode\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jeroen van den Enden",
"email": "info@endroid.nl",
"homepage": "http://endroid.nl/"
}
],
"description": "Endroid QR Code",
"homepage": "https://github.com/endroid/QrCode",
"keywords": [
"bundle",
"code",
"endroid",
"flex",
"qr",
"qrcode",
"symfony"
],
"time": "2018-05-09T20:26:30+00:00"
},
{ {
"name": "ezyang/htmlpurifier", "name": "ezyang/htmlpurifier",
"version": "v4.11.0", "version": "v4.11.0",
@ -1978,6 +2093,56 @@
], ],
"time": "2014-11-09T19:54:17+00:00" "time": "2014-11-09T19:54:17+00:00"
}, },
{
"name": "khanamiryan/qrcode-detector-decoder",
"version": "1",
"source": {
"type": "git",
"url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git",
"reference": "96d5f80680b04803c4f1b69d6e01735e876b80c7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/96d5f80680b04803c4f1b69d6e01735e876b80c7",
"reference": "96d5f80680b04803c4f1b69d6e01735e876b80c7",
"shasum": ""
},
"require": {
"php": "^5.6|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
},
"type": "library",
"autoload": {
"classmap": [
"lib/"
],
"files": [
"lib/common/customFunctions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ashot Khanamiryan",
"email": "a.khanamiryan@gmail.com",
"homepage": "https://github.com/khanamiryan",
"role": "Developer"
}
],
"description": "QR code decoder / reader",
"homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder",
"keywords": [
"barcode",
"qr",
"zxing"
],
"time": "2017-01-13T09:11:46+00:00"
},
{ {
"name": "lcobucci/jwt", "name": "lcobucci/jwt",
"version": "3.3.1", "version": "3.3.1",
@ -2121,6 +2286,51 @@
"homepage": "http://code.google.com/p/minify/", "homepage": "http://code.google.com/p/minify/",
"time": "2016-03-08T11:49:57+00:00" "time": "2016-03-08T11:49:57+00:00"
}, },
{
"name": "myclabs/php-enum",
"version": "1.6.6",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "32c4202886c51fbe5cc3a7c34ec5c9a4a790345e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/32c4202886c51fbe5cc3a7c34ec5c9a4a790345e",
"reference": "32c4202886c51fbe5cc3a7c34ec5c9a4a790345e",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35|^5.7|^6.0",
"squizlabs/php_codesniffer": "1.*"
},
"type": "library",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"description": "PHP Enum implementation",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"time": "2019-02-04T21:18:49+00:00"
},
{ {
"name": "natxet/CssMin", "name": "natxet/CssMin",
"version": "v3.0.4", "version": "v3.0.4",
@ -2410,8 +2620,186 @@
"mail", "mail",
"mailer" "mailer"
], ],
"abandoned": "symfony/mailer",
"time": "2015-06-06T14:19:39+00:00" "time": "2015-06-06T14:19:39+00:00"
}, },
{
"name": "symfony/options-resolver",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
"reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony OptionsResolver Component",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"time": "2018-11-11T11:18:13+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2020-10-23T09:01:57+00:00"
},
{
"name": "symfony/property-access",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "c8f10191183be9bb0d5a1b8364d3891f1bde07b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
"reference": "c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/polyfill-ctype": "~1.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\PropertyAccess\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony PropertyAccess Component",
"homepage": "https://symfony.com",
"keywords": [
"access",
"array",
"extraction",
"index",
"injection",
"object",
"property",
"property path",
"reflection"
],
"time": "2018-11-11T11:18:13+00:00"
},
{ {
"name": "tedivm/jshrink", "name": "tedivm/jshrink",
"version": "v1.1.0", "version": "v1.1.0",

View File

@ -1,162 +0,0 @@
sanya@sanyigep ~/public_html/fitness-web $ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing yiisoft/yii2-composer (2.0.3)
Loading from cache
- Installing bower-asset/accounting (v0.3.2)
Loading from cache
- Installing bower-asset/jquery (2.1.4)
Loading from cache
- Installing bower-asset/jquery.inputmask (3.1.63)
Loading from cache
- Installing bower-asset/moment (2.10.6)
Loading from cache
- Installing bower-asset/punycode (v1.3.2)
Loading from cache
- Installing bower-asset/bootstrap (v3.3.5)
Loading from cache
- Installing bower-asset/remarkable-bootstrap-notify (3.1.3)
Loading from cache
- Installing bower-asset/yii2-pjax (v2.0.4)
Loading from cache
- Installing cebe/markdown (1.1.0)
Loading from cache
- Installing ezyang/htmlpurifier (v4.6.0)
Loading from cache
- Installing yiisoft/yii2 (2.0.6)
Loading from cache
- Installing yiisoft/yii2-bootstrap (2.0.5)
Loading from cache
- Installing bower-asset/fontawesome (v4.4.0)
Loading from cache
- Installing rmrevin/yii2-fontawesome (2.12.2)
Loading from cache
- Installing cebe/yii2-gravatar (1.1)
Loading from cache
- Installing almasaeed2010/adminlte (v2.3.2)
Loading from cache
- Installing dmstr/yii2-adminlte-asset (2.2.4)
Loading from cache
- Installing kartik-v/bootstrap-fileinput (v4.2.7)
Loading from cache
- Installing kartik-v/bootstrap-star-rating (v3.5.4)
Loading from cache
- Installing kartik-v/dependent-dropdown (v1.4.3)
Loading from cache
- Installing kartik-v/yii2-krajee-base (v1.7.7)
Loading from cache
- Installing kartik-v/yii2-widget-typeahead (v1.0.1)
Loading from cache
- Installing kartik-v/yii2-widget-touchspin (v1.2.0)
Loading from cache
- Installing kartik-v/yii2-widget-timepicker (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-switchinput (v1.3.0)
Loading from cache
- Installing kartik-v/yii2-widget-spinner (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-sidenav (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-select2 (v2.0.3)
Loading from cache
- Installing kartik-v/yii2-widget-rating (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-rangeinput (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-growl (v1.1.1)
Loading from cache
- Installing kartik-v/yii2-widget-fileinput (v1.0.3)
Loading from cache
- Installing kartik-v/yii2-widget-depdrop (v1.0.2)
Loading from cache
- Installing kartik-v/yii2-widget-datetimepicker (v1.4.0)
Loading from cache
- Installing kartik-v/yii2-widget-datepicker (v1.3.3)
Loading from cache
- Installing kartik-v/yii2-widget-colorinput (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-alert (v1.1.0)
Loading from cache
- Installing kartik-v/yii2-widget-affix (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-activeform (v1.4.5)
Loading from cache
- Installing kartik-v/yii2-widgets (v3.4.0)
Loading from cache
- Installing bower-asset/jquery-ui (1.11.4)
Loading from cache
- Installing yiisoft/yii2-jui (2.0.4)
Loading from cache
- Installing swiftmailer/swiftmailer (v5.4.1)
Loading from cache
- Installing yiisoft/yii2-swiftmailer (2.0.4)
Loading from cache
- Installing yiisoft/yii2-codeception (2.0.4)
Loading from cache
- Installing yiisoft/yii2-debug (2.0.5)
Loading from cache
- Installing fzaninotto/faker (v1.5.0)
Loading from cache
- Installing yiisoft/yii2-faker (2.0.3)
Loading from cache
- Installing phpspec/php-diff (v1.0.2)
Loading from cache
- Installing bower-asset/typeahead.js (v0.10.5)
Loading from cache
- Installing yiisoft/yii2-gii (2.0.4)
Loading from cache
fzaninotto/faker suggests installing ext-intl (*)
Generating autoload files

View File

@ -9,6 +9,7 @@
namespace mobileapi\controllers; namespace mobileapi\controllers;
use common\components\HttpStatus; use common\components\HttpStatus;
use Endroid\QrCode\QrCode;
use Yii; use Yii;
/** @noinspection PhpUnused */ /** @noinspection PhpUnused */
@ -24,5 +25,17 @@ class PingController extends RestController
Yii::$app->response->setStatusCode( HttpStatus::NO_CONTENT ); Yii::$app->response->setStatusCode( HttpStatus::NO_CONTENT );
} }
/** @noinspection PhpUnused */
public function actionQrcode( )
{
$qrCode = new QrCode('abcd123456');
$response = \Yii::$app->response;
// $response->sendContentAsFile($qrCode->writeString(),$qrCode->getContentType());
return [
'qrcode' => $qrCode->writeDataUri(),
];
// Yii::$app->response->setStatusCode( HttpStatus::NO_CONTENT );
}
} }

View File

@ -17,11 +17,11 @@ class RestController extends Controller
public function behaviors() public function behaviors()
{ {
$behaviors = parent::behaviors(); $behaviors = parent::behaviors();
$behaviors['authenticator'] = [ // $behaviors['authenticator'] = [
'class' => JwtHttpBearerAuth::class, // 'class' => JwtHttpBearerAuth::class,
'auth' => [$this, 'auth'], // 'auth' => [$this, 'auth'],
'optional' => $this->getOptionalActions(), // 'optional' => $this->getOptionalActions(),
]; // ];
return $behaviors; return $behaviors;
} }
@ -30,31 +30,31 @@ class RestController extends Controller
* @param Token $token * @param Token $token
* @return Customer|null * @return Customer|null
*/ */
public function auth($token) // public function auth($token)
{ // {
if ( !isset($token ) ) { // if ( !isset($token ) ) {
return null; // return null;
} // }
try { // try {
$uid = (string) $token->getClaim('uid'); // $uid = (string) $token->getClaim('uid');
$customer = Customer::findOne(['id_customer' => $uid]); // $customer = Customer::findOne(['id_customer' => $uid]);
if (isset($customer)) { // if (isset($customer)) {
\Yii::$app->user->setIdentity($customer); // \Yii::$app->user->setIdentity($customer);
return $customer; // return $customer;
} // }
} catch (Exception $e) { // } catch (Exception $e) {
Yii::error('Failed to load customer: ' . $e->getMessage()); // Yii::error('Failed to load customer: ' . $e->getMessage());
} // }
return null; // return null;
} // }
//
/** // /**
* @see AuthMethod::$optional // * @see AuthMethod::$optional
* @return array // * @return array
*/ // */
protected function getOptionalActions(){ // protected function getOptionalActions(){
return []; // return [];
} // }
} }

BIN
vendor.tar.gz Normal file

Binary file not shown.