From 62db55ecd43b71cf22d37273f2f81c2c4d377dee Mon Sep 17 00:00:00 2001 From: John Berube Date: Wed, 10 Jul 2024 10:22:38 -0400 Subject: [PATCH 01/57] Adds .idea to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 987e2a2..5d13a24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ composer.lock vendor +.idea From cb19f057eae02b8ca28af8e4bc69a9aa8860f16b Mon Sep 17 00:00:00 2001 From: John Berube Date: Wed, 10 Jul 2024 10:23:04 -0400 Subject: [PATCH 02/57] Updates composer.json to allow latest versions of dependencies. --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 96fa71c..185e05c 100644 --- a/composer.json +++ b/composer.json @@ -8,14 +8,14 @@ } ], "require": { - "slim/slim": "3.5.0", - "slim/pdo": "1.9.9", - "monolog/monolog": "1.23.0", - "danielstjules/stringy": "2.3.2", - "zircote/swagger-php": "2.0.7", - "aws/aws-sdk-php": "3.31.4", - "vlucas/phpdotenv": "2.4.0", - "guzzlehttp/guzzle": "6.2.3" + "slim/slim": ">=3.5.0", + "slim/pdo": ">=1.9.9", + "monolog/monolog": ">=1.23.0", + "danielstjules/stringy": ">=2.3.2", + "zircote/swagger-php": ">=2.0.7", + "aws/aws-sdk-php": ">=3.31.4", + "vlucas/phpdotenv": ">=2.4.0", + "guzzlehttp/guzzle": ">=6.2.3" }, "require-dev": { }, From e9306dd71a3e99add7acb603b903a193588f8575 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 11 Jul 2024 10:35:02 -0400 Subject: [PATCH 03/57] Restores phpdotenv back to 2.x --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 185e05c..e9a0926 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "danielstjules/stringy": ">=2.3.2", "zircote/swagger-php": ">=2.0.7", "aws/aws-sdk-php": ">=3.31.4", - "vlucas/phpdotenv": ">=2.4.0", + "vlucas/phpdotenv": "~2.4.0", "guzzlehttp/guzzle": ">=6.2.3" }, "require-dev": { From 66d4e9800b433f42e3ef36395d2959dcaa8d8ccb Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 11 Jul 2024 10:39:25 -0400 Subject: [PATCH 04/57] Upgrades phpdotenv back to 5.x --- composer.json | 2 +- src/Config.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e9a0926..185e05c 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "danielstjules/stringy": ">=2.3.2", "zircote/swagger-php": ">=2.0.7", "aws/aws-sdk-php": ">=3.31.4", - "vlucas/phpdotenv": "~2.4.0", + "vlucas/phpdotenv": ">=2.4.0", "guzzlehttp/guzzle": ">=6.2.3" }, "require-dev": { diff --git a/src/Config.php b/src/Config.php index e2918fc..6311ac1 100644 --- a/src/Config.php +++ b/src/Config.php @@ -141,7 +141,7 @@ protected static function loadLocalEnvironment() ); } - $dotEnv = new Dotenv(self::getConfigDirectory(), self::LOCAL_ENVIRONMENT_FILE); + $dotEnv = Dotenv\Dotenv::createImmutable(self::getConfigDirectory(), self::LOCAL_ENVIRONMENT_FILE); $dotEnv->load(); } From 12c0c6d662d3e814d912243c9b6928fd70f6e43b Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 11 Jul 2024 10:42:29 -0400 Subject: [PATCH 05/57] Upgrades phpdotenv back to 5.x --- src/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Config.php b/src/Config.php index 6311ac1..8df476b 100644 --- a/src/Config.php +++ b/src/Config.php @@ -141,7 +141,7 @@ protected static function loadLocalEnvironment() ); } - $dotEnv = Dotenv\Dotenv::createImmutable(self::getConfigDirectory(), self::LOCAL_ENVIRONMENT_FILE); + $dotEnv = Dotenv::createImmutable(self::getConfigDirectory(), self::LOCAL_ENVIRONMENT_FILE); $dotEnv->load(); } From 8fd60a3f93685c7fb59dac57133d3941358c2b66 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 11 Jul 2024 10:44:18 -0400 Subject: [PATCH 06/57] Upgrades phpdotenv back to 5.x --- src/Config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Config.php b/src/Config.php index 8df476b..e0f10e9 100644 --- a/src/Config.php +++ b/src/Config.php @@ -155,8 +155,8 @@ protected static function loadConfiguration() } if (file_exists(self::getConfigDirectory() . '/' . self::GLOBAL_ENVIRONMENT_FILE)) { - $dotEnv = new Dotenv(self::getConfigDirectory(), self::GLOBAL_ENVIRONMENT_FILE); - $dotEnv->load(); + $dotEnv = Dotenv::createImmutable(self::getConfigDirectory(), self::GLOBAL_ENVIRONMENT_FILE); + $dotEnv->load(); } self::setInitialized(true); From c7f623124039320c048d3e4534d3547b713ccacb Mon Sep 17 00:00:00 2001 From: John Berube Date: Fri, 12 Jul 2024 11:39:37 -0400 Subject: [PATCH 07/57] Refactors logger and slim. --- composer.json | 3 ++- src/APILogger.php | 8 ++++---- src/DefaultContainer.php | 10 +++++----- src/Formatter/NyplLogFormatter.php | 23 +++++------------------ src/Service.php | 12 ++++++++---- 5 files changed, 24 insertions(+), 32 deletions(-) diff --git a/composer.json b/composer.json index 185e05c..fa74aab 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "zircote/swagger-php": ">=2.0.7", "aws/aws-sdk-php": ">=3.31.4", "vlucas/phpdotenv": ">=2.4.0", - "guzzlehttp/guzzle": ">=6.2.3" + "guzzlehttp/guzzle": ">=6.2.3", + "aura/di": "4.*" }, "require-dev": { }, diff --git a/src/APILogger.php b/src/APILogger.php index 899ee7b..29e61b2 100644 --- a/src/APILogger.php +++ b/src/APILogger.php @@ -175,7 +175,7 @@ protected static function formatContext($context) */ public static function addInfo($error = '', $context = []) { - self::getLogger()->addInfo(self::formatMessage($error), self::formatContext($context)); + self::getLogger()->info(self::formatMessage($error), self::formatContext($context)); return true; } @@ -188,7 +188,7 @@ public static function addInfo($error = '', $context = []) */ public static function addError($error = '', $context = []) { - self::getLogger()->addError(self::formatMessage($error), self::formatContext($context)); + self::getLogger()->error(self::formatMessage($error), self::formatContext($context)); return true; } @@ -201,7 +201,7 @@ public static function addError($error = '', $context = []) */ public static function addDebug($error = '', $context = []) { - self::getLogger()->addDebug(self::formatMessage($error), self::formatContext($context)); + self::getLogger()->debug(self::formatMessage($error), self::formatContext($context)); return true; } @@ -214,7 +214,7 @@ public static function addDebug($error = '', $context = []) */ public static function addNotice($error = '', $context = []) { - self::getLogger()->addNotice(self::formatMessage($error), self::formatContext($context)); + self::getLogger()->notice(self::formatMessage($error), self::formatContext($context)); return true; } diff --git a/src/DefaultContainer.php b/src/DefaultContainer.php index 533b0b6..4f4faea 100644 --- a/src/DefaultContainer.php +++ b/src/DefaultContainer.php @@ -1,10 +1,10 @@ getHttpCode(); @@ -47,7 +47,7 @@ protected function initializeErrorResponse(\Throwable $exception, ErrorResponse * @return ErrorResponse * @throws APIException */ - protected function getErrorResponse(\Throwable $exception) + protected function getErrorResponse(\Throwable $exception): ErrorResponse { if ($exception instanceof APIException && $exception->getErrorResponse()) { $errorResponse = $exception->getErrorResponse(); diff --git a/src/Formatter/NyplLogFormatter.php b/src/Formatter/NyplLogFormatter.php index fd1e1a4..f46755b 100644 --- a/src/Formatter/NyplLogFormatter.php +++ b/src/Formatter/NyplLogFormatter.php @@ -1,7 +1,9 @@ translateMonologLevelToString($record['level']); - $record['levelCode'] = $this->translateLevelToInteger($record['level']); + $returnJson = parent::format($logRecord); - $record['timestamp'] = date('c'); - - unset($record['level_name'], $record['channel']); - - if (!$record['extra']) { - unset($record['extra']); - } - - if (!$record['context']) { - unset($record['context']); - } - - $record = parent::format($record); - - return $record; + return $returnJson; } } diff --git a/src/Service.php b/src/Service.php index 3a9f72d..9e2fa68 100644 --- a/src/Service.php +++ b/src/Service.php @@ -1,10 +1,11 @@ getResponseFactory(), $container); $this->setupDefaultRoutes(); } From 4ead0f9ad22cbce360de0ba814f72f89b8e2a2ba Mon Sep 17 00:00:00 2001 From: John Berube Date: Wed, 14 Aug 2024 10:37:40 -0400 Subject: [PATCH 08/57] Refactors container for updates to Aura/DI. --- src/DefaultContainer.php | 10 +++++++--- src/Service.php | 14 +++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/DefaultContainer.php b/src/DefaultContainer.php index 4f4faea..7de565b 100644 --- a/src/DefaultContainer.php +++ b/src/DefaultContainer.php @@ -1,8 +1,10 @@ withHeader("Access-Control-Allow-Origin", "*"); } - public function __construct() + public function __construct( + InjectionFactory $injectionFactory, + ContainerInterface $delegateContainer = null) { - parent::__construct(); + parent::__construct($injectionFactory, $delegateContainer); $this["settings"]["displayErrorDetails"] = false; diff --git a/src/Service.php b/src/Service.php index 9e2fa68..d0fc859 100644 --- a/src/Service.php +++ b/src/Service.php @@ -2,6 +2,7 @@ namespace NYPL\Starter; use Aura\Di\Container; +use Aura\Di\ContainerBuilder; use Slim\App; use Slim\Factory\AppFactory; use Slim\Psr7\Request; @@ -19,9 +20,12 @@ public function __construct(Container $container = null) register_shutdown_function(ErrorHandler::class . "::shutdownFunction"); if (!$container) { - $container = new DefaultContainer(); + $builder = new ContainerBuilder(); + $container = $builder->newInstance(); + //$container->set(ErrorHandler::class, $container->newInstance('NYPL\Starter\ErrorHandler')); } + AppFactory::setContainer($container); $app = AppFactory::create(); @@ -55,6 +59,14 @@ protected function setupDefaultRoutes() ->withHeader('X-NYPL-Response-Date', date('c')); }); + $this->get("[/{params:.*}]", function (Request $request, Response $response) { + return $response + ->withHeader( + "Cache-Control", + "public, max-age=" . self::CACHE_SECONDS_OPTIONS_REQUEST + ); + }); + $this->options("[/{params:.*}]", function (Request $request, Response $response) { return $response ->withHeader( From 2072696620f5d72b7cf5a3044c02aeef09629709 Mon Sep 17 00:00:00 2001 From: John Berube Date: Fri, 16 Aug 2024 16:03:29 -0400 Subject: [PATCH 09/57] Makes updates for PHP8 compatibility. --- composer.json | 2 +- src/DefaultMiddleware.php | 42 ++++++++++++++++++ src/Model/Source.php | 2 +- src/Service.php | 36 +++++++--------- src/Slim/ExtendedDatabase.php | 7 ++- src/Slim/ExtendedSelectStatement.php | 6 +-- src/Slim/ExtendedWhereClause.php | 4 +- src/SwaggerGenerator.php | 64 +++++++++++++++++++++------- 8 files changed, 117 insertions(+), 46 deletions(-) create mode 100644 src/DefaultMiddleware.php diff --git a/composer.json b/composer.json index fa74aab..db08b25 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "require": { "slim/slim": ">=3.5.0", "slim/pdo": ">=1.9.9", - "monolog/monolog": ">=1.23.0", + "monolog/monolog": ">=3.0", "danielstjules/stringy": ">=2.3.2", "zircote/swagger-php": ">=2.0.7", "aws/aws-sdk-php": ">=3.31.4", diff --git a/src/DefaultMiddleware.php b/src/DefaultMiddleware.php new file mode 100644 index 0000000..e89a2d8 --- /dev/null +++ b/src/DefaultMiddleware.php @@ -0,0 +1,42 @@ +withHeader( + "Access-Control-Allow-Headers", + "Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token" + ) + ->withHeader( + "Access-Control-Allow-Methods", + "GET, POST, PUT, PATCH, DELETE, OPTIONS" + ) + ->withHeader( + "Access-Control-Allow-Origin", + "*" + ) + ->withHeader( + "Access-Control-Allow-Credentials", + "true" + ) + ->withHeader('X-NYPL-Original-Request', $request->getUri()) + ->withHeader('X-NYPL-Response-Date', date('c')); + } +} diff --git a/src/Model/Source.php b/src/Model/Source.php index 506c976..9b8537a 100644 --- a/src/Model/Source.php +++ b/src/Model/Source.php @@ -5,7 +5,7 @@ use NYPL\Starter\Model\ModelTrait\DBCreateTrait; use NYPL\Starter\Model\ModelTrait\TranslateTrait; -class Source extends Model +abstract class Source extends Model { use TranslateTrait, DBCreateTrait; diff --git a/src/Service.php b/src/Service.php index d0fc859..75e56f7 100644 --- a/src/Service.php +++ b/src/Service.php @@ -3,11 +3,12 @@ use Aura\Di\Container; use Aura\Di\ContainerBuilder; +use Aura\Di\Injection\InjectionFactory; use Slim\App; use Slim\Factory\AppFactory; -use Slim\Psr7\Request; -use Slim\Psr7\Response; - +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Response; +use NYPL\Starter\DefaultMiddleware; class Service extends App { const CACHE_SECONDS_OPTIONS_REQUEST = 600; @@ -36,7 +37,8 @@ public function __construct(Container $container = null) protected function setupDefaultRoutes() { - $this->add(function (Request $request, Response $response, callable $next) { + + $middleware = function (Request $request, Response $response, callable $next) { $response = $next($request, $response); return $response ->withHeader( @@ -57,22 +59,16 @@ protected function setupDefaultRoutes() ) ->withHeader('X-NYPL-Original-Request', $request->getUri()) ->withHeader('X-NYPL-Response-Date', date('c')); - }); + }; - $this->get("[/{params:.*}]", function (Request $request, Response $response) { - return $response - ->withHeader( - "Cache-Control", - "public, max-age=" . self::CACHE_SECONDS_OPTIONS_REQUEST - ); - }); - - $this->options("[/{params:.*}]", function (Request $request, Response $response) { - return $response - ->withHeader( - "Cache-Control", - "public, max-age=" . self::CACHE_SECONDS_OPTIONS_REQUEST - ); - }); + $this->addRoutingMiddleware($middleware); +// +// $this->options("[/{params:.*}]", function (Request $request, Response $response) { +// return $response +// ->withHeader( +// "Cache-Control", +// "public, max-age=" . self::CACHE_SECONDS_OPTIONS_REQUEST +// ); +// }); } } diff --git a/src/Slim/ExtendedDatabase.php b/src/Slim/ExtendedDatabase.php index 6b5cc8d..cc843c3 100644 --- a/src/Slim/ExtendedDatabase.php +++ b/src/Slim/ExtendedDatabase.php @@ -1,7 +1,9 @@ host = Config::get('SWAGGER_HOST'); + $openapi = $generator->scan($directory, ['exclude' => ['tests'], 'pattern' => '*.php']); - $swagger->basePath = '/api'; +// $openapi->host = Config::get('SWAGGER_HOST'); +// +// $openapi->basePath = '/api'; +// +// $openapi->schemes = [ +// Config::get('SWAGGER_SCHEME') +// ]; - $swagger->schemes = [ - Config::get('SWAGGER_SCHEME') - ]; + $json = $openapi->toJson(); + + + $streamBody = fopen('data://text/plain,' . $json,'r'); + + return $response->withHeader('Content-Type', 'application/json') + ->withHeader('Access-Control-Allow-Origin', '*') + ->withHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') + ->withHeader('Access-Control-Allow-Credentials', 'true') + ->withHeader( + 'Access-Control-Allow-Headers', + 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token' + ) + ->withBody(new \GuzzleHttp\Psr7\Stream($streamBody)); + + +// +// $finder = \Symfony\Component\Finder\Finder::create()->files()->name('*.php')->in($directory); +// +// $openapi = (new \OpenApi\Generator())->generate([$directory, $finder]); +// +// $json = $openapi->toJson(); +// +// +// $streamBody = fopen('data://text/plain,' . $json,'r'); +// +// return $response->withHeader('Content-Type', 'application/json') +// ->withHeader('Access-Control-Allow-Origin', '*') +// ->withHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') +// ->withHeader('Access-Control-Allow-Credentials', 'true') +// ->withHeader( +// 'Access-Control-Allow-Headers', +// 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token' +// ) +// ->withBody(new \GuzzleHttp\Psr7\Stream($streamBody)); - return $response->withJson($swagger) - ->withHeader('Access-Control-Allow-Origin', '*') - ->withHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') - ->withHeader('Access-Control-Allow-Credentials', 'true') - ->withHeader( - 'Access-Control-Allow-Headers', - 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token' - ); } } From 507358e3b43a7ab9710e432462e3ff7ca34b1fa8 Mon Sep 17 00:00:00 2001 From: John Berube Date: Tue, 10 Sep 2024 17:42:17 -0400 Subject: [PATCH 10/57] Updates Controller to use newer Request interface --- src/Controller.php | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/src/Controller.php b/src/Controller.php index ce95705..5e2cc6c 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -5,9 +5,8 @@ use NYPL\Starter\Model\Source; use NYPL\Starter\Model\IdentityHeader; use NYPL\Starter\Model\Response\SuccessResponse; -use Psr\Http\Message\ResponseInterface; -use Slim\Http\Request; -use Slim\Http\Response; +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as Request; abstract class Controller { @@ -218,10 +217,10 @@ protected function generateId(Source $source) */ protected function addQueryFilter(ModelSet $model, $queryParameterName = '') { - if ($this->getRequest()->getQueryParam($queryParameterName)) { + if ($this->getQueryParam($queryParameterName)) { $filter = new QueryFilter( $queryParameterName, - $this->getRequest()->getQueryParam($queryParameterName) + $this->getQueryParam($queryParameterName) ); $model->addFilter($filter); @@ -237,6 +236,7 @@ protected function addQueryFilter(ModelSet $model, $queryParameterName = '') * @param array $queryParameters * * @return Response + * @throws APIException */ protected function getDefaultReadResponse( Model $model, @@ -245,11 +245,11 @@ protected function getDefaultReadResponse( array $queryParameters = [] ) { if ($model instanceof ModelSet) { - $model->setOffset($this->getRequest()->getParam('offset')); + $model->setOffset($this->getQueryParam('offset')); - $model->setLimit($this->getRequest()->getParam('limit')); + $model->setLimit($this->getQueryParam('limit')); - $includeTotalCount = $this->getRequest()->getParam('includeTotalCount') === 'true' ? true : false ; + $includeTotalCount = $this->getQueryParam('includeTotalCount') === 'true' ? true : false ; if ($includeTotalCount) { $model->setIncludeTotalCount($includeTotalCount); @@ -346,7 +346,6 @@ public function checkScopes($allowedScopes = []) ); } - /** * @param string $message * @@ -362,4 +361,32 @@ public function denyAccess($message = '') 403 ); } + + /** + * Get query parameters from request as array. + * + * @return null|array + */ + public function getQueryParams(): ?array + { + parse_str($this->getRequest()->getUri()->getQuery(), $queryParameters); + return $queryParameters; + } + + /** + * Get query parameter value from request. + * + * @param string $var + * @return null|string + */ + public function getQueryParam(string $var): ?string + { + $params = $this->getQueryParams(); + $val = null; + if (isset($params[$var])) { + $val = $params[$var]; + } + return $val; + } + } From be5688e50dc2defe30da331109960f257ee2bb2a Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 19 Sep 2024 16:39:16 -0400 Subject: [PATCH 11/57] Replaces getenv() with --- src/Config.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Config.php b/src/Config.php index e0f10e9..fc8dcff 100644 --- a/src/Config.php +++ b/src/Config.php @@ -47,12 +47,12 @@ public static function initialize($configDirectory = '') */ public static function get($name = '', $defaultValue = null, $isEncrypted = false) { - if (getenv($name) !== false) { + if (!empty($_ENV[$name])) { if ($isEncrypted && self::isEncryptedEnvironment()) { return self::decryptEnvironmentVariable($name); } - return (string) getenv($name); + return (string) $_ENV[$name]; } return $defaultValue; @@ -109,7 +109,7 @@ protected static function isEncryptedEnvironment() */ protected static function decryptEnvironmentVariable($name = '') { - if (!getenv($name)) { + if (empty($_ENV[$name])) { return ''; } @@ -120,7 +120,7 @@ protected static function decryptEnvironmentVariable($name = '') } $decryptedValue = (string) self::getKeyClient()->decrypt([ - 'CiphertextBlob' => base64_decode(getenv($name)), + 'CiphertextBlob' => base64_decode($_ENV[$name]), ])['Plaintext']; AppCache::set($cacheKey, $decryptedValue); @@ -155,8 +155,8 @@ protected static function loadConfiguration() } if (file_exists(self::getConfigDirectory() . '/' . self::GLOBAL_ENVIRONMENT_FILE)) { - $dotEnv = Dotenv::createImmutable(self::getConfigDirectory(), self::GLOBAL_ENVIRONMENT_FILE); - $dotEnv->load(); + $dotEnv = Dotenv::createImmutable(self::getConfigDirectory(), self::GLOBAL_ENVIRONMENT_FILE); + $dotEnv->load(); } self::setInitialized(true); From 2528d9749d541e9f07e5eaa769970b27ab41b96f Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 19 Sep 2024 16:55:21 -0400 Subject: [PATCH 12/57] Adds getJsonResponse() method to output response as JSON. --- src/Controller.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Controller.php b/src/Controller.php index 5e2cc6c..24ce553 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -5,8 +5,10 @@ use NYPL\Starter\Model\Source; use NYPL\Starter\Model\IdentityHeader; use NYPL\Starter\Model\Response\SuccessResponse; +use Psr\Http\Message\MessageInterface; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; +use \GuzzleHttp\Psr7\Stream; abstract class Controller { @@ -91,6 +93,16 @@ public function setResponse(Response $response) $this->response = $response; } + /** + * @return MessageInterface + */ + public function getJsonResponse($data) + { + $json = json_encode($data); + $streamBody = fopen('data://text/plain,' . $json,'r'); + return $this->getResponse()->withBody(new Stream($streamBody)); + } + /** * @return string */ @@ -283,7 +295,7 @@ protected function getDefaultReadResponse( $response->initializeResponse($model); } - return $this->getResponse()->withJson($response); + return $this->getJsonResponse($response); } /** From a841d1a0c7f6c3bb1f90478bb6ddf912a0136fa5 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 19 Sep 2024 16:56:58 -0400 Subject: [PATCH 13/57] Replaces usage of obsolete withJson() method. --- src/DefaultContainer.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/DefaultContainer.php b/src/DefaultContainer.php index 7de565b..978aa36 100644 --- a/src/DefaultContainer.php +++ b/src/DefaultContainer.php @@ -2,11 +2,12 @@ namespace NYPL\Starter; use Aura\Di\Injection\InjectionFactory; +use GuzzleHttp\Psr7\Stream; use NYPL\Starter\Model\Response\ErrorResponse; use Aura\Di\Container; use Psr\Container\ContainerInterface; -use Slim\Psr7\Request; -use Slim\Psr7\Response; +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as Request; class DefaultContainer extends Container { @@ -84,9 +85,11 @@ protected function handleError(Container $container, Request $request, \Throwabl { $this->logError($request, $exception); + $json = json_encode($this->getErrorResponse($exception)); + $streamBody = fopen('data://text/plain,' . $json,'r'); return $container["response"] ->withStatus($this->getStatusCode($exception)) - ->withJson($this->getErrorResponse($exception)) + ->withBody(new Stream($streamBody)) ->withHeader("Access-Control-Allow-Origin", "*"); } From 7ed972206996091fe3dca12346ed51ccdffdee13 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 19 Sep 2024 16:57:46 -0400 Subject: [PATCH 14/57] Updates where statements to use new Conditional class. --- src/Model/ModelTrait/DBReadTrait.php | 53 ++++++++++++++++------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/src/Model/ModelTrait/DBReadTrait.php b/src/Model/ModelTrait/DBReadTrait.php index 3f12e1c..2051714 100644 --- a/src/Model/ModelTrait/DBReadTrait.php +++ b/src/Model/ModelTrait/DBReadTrait.php @@ -1,6 +1,8 @@ select() ->from($this->getTableName()); - $this->applyFilters($this->getFilters(), $selectStatement); return $selectStatement; @@ -74,11 +76,11 @@ protected function getOperator(Filter $filter) /** * @param int $count * @param Filter $filter - * @param StatementContainer $selectStatement + * @param StatementInterface $selectStatement * * @return bool */ - protected function applyOrWhere($count, Filter $filter, StatementContainer $selectStatement) + protected function applyOrWhere($count, Filter $filter, StatementInterface $selectStatement) { if (!$count) { $this->addWhere($filter, $selectStatement); @@ -98,11 +100,11 @@ protected function applyOrWhere($count, Filter $filter, StatementContainer $sele /** * @param int $count * @param Filter $filter - * @param StatementContainer $selectStatement + * @param StatementInterface $selectStatement * * @return bool */ - protected function applyAndWhere($count, Filter $filter, StatementContainer $selectStatement) + protected function applyAndWhere($count, Filter $filter, StatementInterface $selectStatement) { if (!$count) { $selectStatement->orWhere( @@ -140,12 +142,12 @@ protected function addOrWhere(OrFilter $orFilter, ExtendedSelectStatement $selec /** * @param Filter $filter - * @param StatementContainer $selectStatement + * @param StatementInterface $selectStatement * * @return bool * @throws APIException */ - protected function addWhere(Filter $filter, StatementContainer $selectStatement) + protected function addWhere(Filter $filter, StatementInterface $selectStatement) { if ($filter instanceof OrFilter) { $this->addOrWhere($filter, $selectStatement); @@ -186,12 +188,12 @@ protected function addWhere(Filter $filter, StatementContainer $selectStatement) /** * @param Filter $filter - * @param StatementContainer $selectStatement + * @param StatementInterface $selectStatement * * @return bool * @throws APIException */ - protected function addJsonWhere(Filter $filter, StatementContainer $selectStatement) + protected function addJsonWhere(Filter $filter, StatementInterface $selectStatement) { $values = explode(',', $filter->getFilterValue()); @@ -201,23 +203,23 @@ protected function addJsonWhere(Filter $filter, StatementContainer $selectStatem $valueString .= DB::getDatabase()->quote($value) . ','; } - $selectStatement->where( + $selectStatement->where(new Conditional( 'jsonb_contains_or(' . $this->translateDbName($filter->getFilterColumn()) . ', array[' . substr($valueString, 0, -1) . '])', '=', true - ); + )); return true; } /** * @param Filter $filter - * @param StatementContainer $selectStatement + * @param StatementInterface $selectStatement * * @return bool * @throws APIException */ - protected function applyRange(Filter $filter, StatementContainer $selectStatement) + protected function applyRange(Filter $filter, StatementInterface $selectStatement) { $this->setOrderBy($this->translateDbName($filter->getFilterColumn())); @@ -238,21 +240,21 @@ protected function applyRange(Filter $filter, StatementContainer $selectStatemen ); } - $selectStatement->where( + $selectStatement->where(new Conditional( $this->translateDbName($filter->getFilterColumn()), '<', $range[1] - ); + )); return true; } if (!$range[1]) { - $selectStatement->where( + $selectStatement->where(new Conditional( $this->translateDbName($filter->getFilterColumn()), '>=', $range[0] - ); + )); return true; } @@ -266,11 +268,11 @@ protected function applyRange(Filter $filter, StatementContainer $selectStatemen /** * @param Filter $filter - * @param StatementContainer $selectStatement + * @param StatementInterface $selectStatement * * @return bool */ - protected function applyWhere(Filter $filter, StatementContainer $selectStatement) + protected function applyWhere(Filter $filter, StatementInterface $selectStatement) { if (strpos($filter->getFilterValue(), ',') !== false) { $selectStatement->whereIn( @@ -281,12 +283,19 @@ protected function applyWhere(Filter $filter, StatementContainer $selectStatemen return true; } - $selectStatement->where( + $conditional = new Conditional( $this->translateDbName($filter->getFilterColumn()), $this->getOperator($filter), $filter->getFilterValue() ); + if ($existingWhere = $selectStatement->getWhere()) { + $grouping = new Grouping('AND', $conditional, $existingWhere); + } else { + $grouping = $conditional; + } + $selectStatement->where($grouping); + return true; } @@ -319,7 +328,7 @@ protected function setSet($ignoreNoRecord = false) } if ($this->getLimit()) { - $selectStatement->limit($this->getLimit()); + $selectStatement->limit(new Limit($this->getLimit())); } $selectStatement = $selectStatement->execute(); From 96e3bddfd11caf40ebcb1d895f8c32fe4e029e79 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 19 Sep 2024 16:58:35 -0400 Subject: [PATCH 15/57] Replaces StatementContainer usage with StatementInterface. --- src/Model/ModelTrait/DBTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Model/ModelTrait/DBTrait.php b/src/Model/ModelTrait/DBTrait.php index 9bafbc2..e883ad8 100644 --- a/src/Model/ModelTrait/DBTrait.php +++ b/src/Model/ModelTrait/DBTrait.php @@ -4,7 +4,7 @@ use NYPL\Starter\Slim\DB; use NYPL\Starter\Filter; use NYPL\Starter\Model; -use Slim\PDO\Statement\StatementContainer; +use FaaPz\PDO\StatementInterface; trait DBTrait { @@ -36,9 +36,9 @@ public function getIdFilters() /** * @param Filter[] $filters - * @param StatementContainer $sqlStatement + * @param StatementInterface $sqlStatement */ - public function applyFilters(array $filters, StatementContainer $sqlStatement) + public function applyFilters(array $filters, StatementInterface $sqlStatement) { foreach ($filters as $filter) { $this->addWhere( From 247ddb3e0d6a9f737169cc882803f2d355fa029d Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 19 Sep 2024 16:59:17 -0400 Subject: [PATCH 16/57] Adds getWhere() method to get the where clause of a sql select statement. --- src/Slim/ExtendedSelectStatement.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Slim/ExtendedSelectStatement.php b/src/Slim/ExtendedSelectStatement.php index 9aad83e..846859d 100644 --- a/src/Slim/ExtendedSelectStatement.php +++ b/src/Slim/ExtendedSelectStatement.php @@ -28,4 +28,9 @@ public function closeParenthesis() { $this->whereClause->closeParenthesis(); } + + public function getWhere() { + return $this->where; + } + } From 227d26226c32ffe7802080f373e14898f235fae2 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 19 Sep 2024 16:59:38 -0400 Subject: [PATCH 17/57] Adds back options to json response. --- src/SwaggerGenerator.php | 44 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/src/SwaggerGenerator.php b/src/SwaggerGenerator.php index 235bcaa..59509e5 100644 --- a/src/SwaggerGenerator.php +++ b/src/SwaggerGenerator.php @@ -9,25 +9,18 @@ class SwaggerGenerator { public static function generate(array $directory, Response $response) { - //ErrorHandler::setIgnoreError(true); + ErrorHandler::setIgnoreError(true); $generator = new Generator(new DefaultLogger()); - $openapi = $generator->scan($directory, ['exclude' => ['tests'], 'pattern' => '*.php']); - -// $openapi->host = Config::get('SWAGGER_HOST'); -// -// $openapi->basePath = '/api'; -// -// $openapi->schemes = [ -// Config::get('SWAGGER_SCHEME') -// ]; - - $json = $openapi->toJson(); - - + $docs = json_decode($openapi->toJson()); + $docs->host = Config::get('SWAGGER_HOST'); + $docs->basePath = '/api'; + $docs->schemes = [ + Config::get('SWAGGER_SCHEME') + ]; + $json = json_encode($docs); $streamBody = fopen('data://text/plain,' . $json,'r'); - return $response->withHeader('Content-Type', 'application/json') ->withHeader('Access-Control-Allow-Origin', '*') ->withHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') @@ -38,26 +31,5 @@ public static function generate(array $directory, Response $response) ) ->withBody(new \GuzzleHttp\Psr7\Stream($streamBody)); - -// -// $finder = \Symfony\Component\Finder\Finder::create()->files()->name('*.php')->in($directory); -// -// $openapi = (new \OpenApi\Generator())->generate([$directory, $finder]); -// -// $json = $openapi->toJson(); -// -// -// $streamBody = fopen('data://text/plain,' . $json,'r'); -// -// return $response->withHeader('Content-Type', 'application/json') -// ->withHeader('Access-Control-Allow-Origin', '*') -// ->withHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') -// ->withHeader('Access-Control-Allow-Credentials', 'true') -// ->withHeader( -// 'Access-Control-Allow-Headers', -// 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token' -// ) -// ->withBody(new \GuzzleHttp\Psr7\Stream($streamBody)); - } } From 1a2714e4a1d8cd442796dcea6764e4c41d9ffc05 Mon Sep 17 00:00:00 2001 From: John Berube Date: Fri, 20 Sep 2024 15:50:56 -0400 Subject: [PATCH 18/57] Updates composer.json to stay on major versions. --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index db08b25..354cf75 100644 --- a/composer.json +++ b/composer.json @@ -8,14 +8,14 @@ } ], "require": { - "slim/slim": ">=3.5.0", - "slim/pdo": ">=1.9.9", - "monolog/monolog": ">=3.0", - "danielstjules/stringy": ">=2.3.2", - "zircote/swagger-php": ">=2.0.7", - "aws/aws-sdk-php": ">=3.31.4", - "vlucas/phpdotenv": ">=2.4.0", - "guzzlehttp/guzzle": ">=6.2.3", + "slim/slim": "^4.14.0", + "slim/pdo": "^2.2.0", + "monolog/monolog": "^3.7.0", + "danielstjules/stringy": "^3.1", + "zircote/swagger-php": "^4.10.6", + "aws/aws-sdk-php": "^3.319.4", + "vlucas/phpdotenv": "^5.6.1", + "guzzlehttp/guzzle": "^7.9.2", "aura/di": "4.*" }, "require-dev": { From e13820f6d5645028cd199d1788122d053114eefd Mon Sep 17 00:00:00 2001 From: Keith Bauer Date: Mon, 30 Sep 2024 14:43:37 -0500 Subject: [PATCH 19/57] Update inserting array values --- src/Model/ModelTrait/DBCreateTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/ModelTrait/DBCreateTrait.php b/src/Model/ModelTrait/DBCreateTrait.php index 0a3242a..452202a 100644 --- a/src/Model/ModelTrait/DBCreateTrait.php +++ b/src/Model/ModelTrait/DBCreateTrait.php @@ -83,7 +83,7 @@ protected function createDbRecord($useId = false) $insertStatement = DB::getDatabase()->insert(array_keys($insertValues)) ->into($this->getTableName()) - ->values(array_values($insertValues)); + ->values(...array_values($insertValues)); $insertStatement->execute(false); From 255563f9d0a3acde7f357c5bcfd464b3d1508836 Mon Sep 17 00:00:00 2001 From: John Berube Date: Tue, 15 Oct 2024 11:33:13 +0200 Subject: [PATCH 20/57] Updates middleware functions. --- src/Controller.php | 3 --- src/Service.php | 25 +++++++++++-------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Controller.php b/src/Controller.php index 24ce553..0dadeaa 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -53,11 +53,8 @@ public function __construct(Request $request, Response $response, $cacheSeconds { $this->setRequest($request); $this->setResponse($response); - $this->addCacheHeader($cacheSeconds); - $this->initializeContentType(); - $this->initializeIdentityHeader(); } diff --git a/src/Service.php b/src/Service.php index 75e56f7..bffdaa6 100644 --- a/src/Service.php +++ b/src/Service.php @@ -23,13 +23,13 @@ public function __construct(Container $container = null) if (!$container) { $builder = new ContainerBuilder(); $container = $builder->newInstance(); - //$container->set(ErrorHandler::class, $container->newInstance('NYPL\Starter\ErrorHandler')); } - AppFactory::setContainer($container); $app = AppFactory::create(); + $app->addBodyParsingMiddleware(); + parent::__construct($app->getResponseFactory(), $container); $this->setupDefaultRoutes(); @@ -37,8 +37,7 @@ public function __construct(Container $container = null) protected function setupDefaultRoutes() { - - $middleware = function (Request $request, Response $response, callable $next) { + $this->add(function (Request $request, Response $response, callable $next) { $response = $next($request, $response); return $response ->withHeader( @@ -59,16 +58,14 @@ protected function setupDefaultRoutes() ) ->withHeader('X-NYPL-Original-Request', $request->getUri()) ->withHeader('X-NYPL-Response-Date', date('c')); - }; + }); - $this->addRoutingMiddleware($middleware); -// -// $this->options("[/{params:.*}]", function (Request $request, Response $response) { -// return $response -// ->withHeader( -// "Cache-Control", -// "public, max-age=" . self::CACHE_SECONDS_OPTIONS_REQUEST -// ); -// }); + $this->options("[/{params:.*}]", function (Request $request, Response $response) { + return $response + ->withHeader( + "Cache-Control", + "public, max-age=" . self::CACHE_SECONDS_OPTIONS_REQUEST + ); + }); } } From 6a8f4b32181011d39ba5f47fb5b45816bcc6f5fd Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 17 Oct 2024 16:39:27 +0200 Subject: [PATCH 21/57] Replaces slim/pdo dependency with faapz/pdo. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 354cf75..46cc246 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "require": { "slim/slim": "^4.14.0", - "slim/pdo": "^2.2.0", + "faapz/pdo": "^2.2.0", "monolog/monolog": "^3.7.0", "danielstjules/stringy": "^3.1", "zircote/swagger-php": "^4.10.6", From b0c64e107d78729ee1abbfa1d6f9f1207456c9cd Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 17 Oct 2024 16:41:03 +0200 Subject: [PATCH 22/57] Removes default empty string values from first two params since third param has no default value. --- src/CachedStringy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CachedStringy.php b/src/CachedStringy.php index 8eb7c18..c2cbb82 100644 --- a/src/CachedStringy.php +++ b/src/CachedStringy.php @@ -43,7 +43,7 @@ protected static function setCachedString($type = '', $originalString = '', $str * * @return string */ - protected static function runStringy($type = '', $string = '', callable $stringy) + protected static function runStringy($type, $string, callable $stringy) { if ($cachedString = self::getCachedString($type, $string)) { return $cachedString; From ebecf051b028f1006d23abe93d4957b4a31a6a93 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 17 Oct 2024 16:41:37 +0200 Subject: [PATCH 23/57] Adds return type to model. --- src/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model.php b/src/Model.php index fcd78d7..5650779 100644 --- a/src/Model.php +++ b/src/Model.php @@ -84,7 +84,7 @@ protected function addToJsonArray($objectName, $objectValue) return true; } - public function jsonSerialize() + public function jsonSerialize(): mixed { $jsonArray = []; From 2dbe5b6db0f1d44584bad284d49d2dfa9a041ce3 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 17 Oct 2024 16:42:32 +0200 Subject: [PATCH 24/57] Instantiates whereClause variable. --- src/Slim/ExtendedSelectStatement.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Slim/ExtendedSelectStatement.php b/src/Slim/ExtendedSelectStatement.php index 846859d..0a13c44 100644 --- a/src/Slim/ExtendedSelectStatement.php +++ b/src/Slim/ExtendedSelectStatement.php @@ -3,9 +3,15 @@ use FaaPz\PDO\Database; use FaaPz\PDO\Statement\Select; +use GuzzleHttp\Client; class ExtendedSelectStatement extends Select { + /** + * @var ExtendedWhereClause + */ + protected $whereClause; + /** * ExtendedSelectStatement constructor. * @@ -28,9 +34,9 @@ public function closeParenthesis() { $this->whereClause->closeParenthesis(); } - + public function getWhere() { return $this->where; } - + } From 9946706f103d231708450cc9ba0f78f42299921e Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 17 Oct 2024 16:44:28 +0200 Subject: [PATCH 25/57] Replaces @SWG annotations with @OA. --- src/CacheModel/BaseJob.php | 10 +++++----- src/CacheModel/BaseJob/Job.php | 12 ++++++------ src/CacheModel/BaseJob/NewJob.php | 2 +- src/CacheModel/JobNotice.php | 6 +++--- src/CacheModel/JobNotice/JobNoticeCreated.php | 4 ++-- src/CacheModel/JobStatus.php | 8 ++++---- src/CacheModel/JobStatus/JobSuccessStatus.php | 4 ++-- src/Controller.php | 3 +++ src/Model/BulkError.php | 8 ++++---- src/Model/ModelTrait/DBCreateTrait.php | 2 +- src/Model/Response.php | 2 +- src/Model/Response/BulkResponse.php | 8 ++++---- src/Model/Response/ErrorResponse.php | 10 +++++----- src/Model/Response/SuccessResponse.php | 2 +- 14 files changed, 42 insertions(+), 39 deletions(-) diff --git a/src/CacheModel/BaseJob.php b/src/CacheModel/BaseJob.php index a0ce717..b8980af 100644 --- a/src/CacheModel/BaseJob.php +++ b/src/CacheModel/BaseJob.php @@ -6,31 +6,31 @@ class BaseJob extends CacheModel { /** - * @SWG\Property(example="https://www.nypl.org/item/121") + * @OA\Property(example="https://www.nypl.org/item/121") * @var string */ public $successRedirectUrl = ''; /** - * @SWG\Property(example="https://www.nypl.org/callback") + * @OA\Property(example="https://www.nypl.org/callback") * @var string */ public $startCallbackUrl = ''; /** - * @SWG\Property(example="https://www.nypl.org/callback") + * @OA\Property(example="https://www.nypl.org/callback") * @var string */ public $successCallbackUrl = ''; /** - * @SWG\Property(example="https://www.nypl.org/callback") + * @OA\Property(example="https://www.nypl.org/callback") * @var string */ public $failureCallbackUrl = ''; /** - * @SWG\Property(example="https://www.nypl.org/callback") + * @OA\Property(example="https://www.nypl.org/callback") * @var string */ public $updateCallbackUrl = ''; diff --git a/src/CacheModel/BaseJob/Job.php b/src/CacheModel/BaseJob/Job.php index e1c933e..5cfbb60 100644 --- a/src/CacheModel/BaseJob/Job.php +++ b/src/CacheModel/BaseJob/Job.php @@ -10,38 +10,38 @@ use NYPL\Starter\Model\ModelTrait\CacheUpdateTrait; /** - * @SWG\Definition(title="Job", type="object", required={"id"}) + * @OA\Schema(title="Job", type="object", required={"id"}) */ class Job extends BaseJob implements DeleteInterface { use CacheCreateTrait, CacheUpdateTrait, CacheDeleteTrait, CacheLockTrait; /** - * @SWG\Property(example="37580c4174e059a") + * @OA\Property(example="37580c4174e059a") * @var string */ public $id = ''; /** - * @SWG\Property(example=false) + * @OA\Property(example=false) * @var bool */ public $started = false; /** - * @SWG\Property(example=false) + * @OA\Property(example=false) * @var bool */ public $finished = false; /** - * @SWG\Property(example=false) + * @OA\Property(example=false) * @var bool */ public $success = false; /** - * @SWG\Property + * @OA\Property * @var JobNoticeCreated[] */ public $notices; diff --git a/src/CacheModel/BaseJob/NewJob.php b/src/CacheModel/BaseJob/NewJob.php index fc8d04e..b2494a8 100644 --- a/src/CacheModel/BaseJob/NewJob.php +++ b/src/CacheModel/BaseJob/NewJob.php @@ -4,7 +4,7 @@ use NYPL\Starter\CacheModel\BaseJob; /** - * @SWG\Definition(type="object") + * @OA\Schema(type="object") */ class NewJob extends BaseJob { diff --git a/src/CacheModel/JobNotice.php b/src/CacheModel/JobNotice.php index d834d15..f0c436e 100644 --- a/src/CacheModel/JobNotice.php +++ b/src/CacheModel/JobNotice.php @@ -4,18 +4,18 @@ use NYPL\Starter\CacheModel; /** - * @SWG\Definition(type="object") + * @OA\Schema(type="object") */ class JobNotice extends CacheModel { /** - * @SWG\Property(example="Processing has started...", type="string") + * @OA\Property(example="Processing has started...", type="string") * @var string */ public $text = ''; /** - * @SWG\Property(type="object") + * @OA\Property(type="object") * @var mixed */ public $data; diff --git a/src/CacheModel/JobNotice/JobNoticeCreated.php b/src/CacheModel/JobNotice/JobNoticeCreated.php index 3f79fd6..6cb5fca 100644 --- a/src/CacheModel/JobNotice/JobNoticeCreated.php +++ b/src/CacheModel/JobNotice/JobNoticeCreated.php @@ -5,12 +5,12 @@ use NYPL\Starter\Model\LocalDateTime; /** - * @SWG\Definition(type="object") + * @OA\Schema(type="object") */ class JobNoticeCreated extends JobNotice { /** - * @SWG\Property(example="2008-12-24T03:16:00Z", type="string") + * @OA\Property(example="2008-12-24T03:16:00Z", type="string") * @var LocalDateTime */ public $createdDate; diff --git a/src/CacheModel/JobStatus.php b/src/CacheModel/JobStatus.php index 8206846..07687a7 100644 --- a/src/CacheModel/JobStatus.php +++ b/src/CacheModel/JobStatus.php @@ -5,24 +5,24 @@ use NYPL\Starter\CacheModel\JobNotice\JobNoticeCreated; /** - * @SWG\Definition(type="object") + * @OA\Schema(type="object") */ class JobStatus extends CacheModel { /** - * @SWG\Property + * @OA\Property * @var JobNoticeCreated */ public $notice; /** - * @SWG\Property(example="https://www.nypl.org/callback") + * @OA\Property(example="https://www.nypl.org/callback") * @var string */ public $callBackUrl = ''; /** - * @SWG\Property(type="object") + * @OA\Property(type="object") * @var array */ public $callBackData = []; diff --git a/src/CacheModel/JobStatus/JobSuccessStatus.php b/src/CacheModel/JobStatus/JobSuccessStatus.php index 6643a3e..a2afe18 100644 --- a/src/CacheModel/JobStatus/JobSuccessStatus.php +++ b/src/CacheModel/JobStatus/JobSuccessStatus.php @@ -4,12 +4,12 @@ use NYPL\Starter\CacheModel\JobStatus; /** - * @SWG\Definition(type="object") + * @OA\Schema(type="object") */ class JobSuccessStatus extends JobStatus { /** - * @SWG\Property(example="https://www.nypl.org/id/12121") + * @OA\Property(example="https://www.nypl.org/id/12121") * @var string */ public $successRedirectUrl = ''; diff --git a/src/Controller.php b/src/Controller.php index 0dadeaa..24ce553 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -53,8 +53,11 @@ public function __construct(Request $request, Response $response, $cacheSeconds { $this->setRequest($request); $this->setResponse($response); + $this->addCacheHeader($cacheSeconds); + $this->initializeContentType(); + $this->initializeIdentityHeader(); } diff --git a/src/Model/BulkError.php b/src/Model/BulkError.php index acc9f99..550630b 100644 --- a/src/Model/BulkError.php +++ b/src/Model/BulkError.php @@ -4,24 +4,24 @@ use NYPL\Starter\APILogger; /** - * @SWG\Definition(name="BulkError", type="object") + * @OA\Schema(name="BulkError", type="object") */ class BulkError { /** - * @SWG\Property(format="int32") + * @OA\Property(format="int32") * @var int */ public $index = 0; /** - * @SWG\Property(example="Description of error") + * @OA\Property(example="Description of error") * @var string */ public $message = ''; /** - * @SWG\Property(type="object") + * @OA\Property(type="object") * @var array */ public $data = []; diff --git a/src/Model/ModelTrait/DBCreateTrait.php b/src/Model/ModelTrait/DBCreateTrait.php index 452202a..0a3242a 100644 --- a/src/Model/ModelTrait/DBCreateTrait.php +++ b/src/Model/ModelTrait/DBCreateTrait.php @@ -83,7 +83,7 @@ protected function createDbRecord($useId = false) $insertStatement = DB::getDatabase()->insert(array_keys($insertValues)) ->into($this->getTableName()) - ->values(...array_values($insertValues)); + ->values(array_values($insertValues)); $insertStatement->execute(false); diff --git a/src/Model/Response.php b/src/Model/Response.php index 673585b..d286968 100644 --- a/src/Model/Response.php +++ b/src/Model/Response.php @@ -6,7 +6,7 @@ abstract class Response { /** - * @SWG\Property(type="object") + * @OA\Property(type="object") * @var array */ public $debugInfo = []; diff --git a/src/Model/Response/BulkResponse.php b/src/Model/Response/BulkResponse.php index 69bc9e3..9fa1492 100644 --- a/src/Model/Response/BulkResponse.php +++ b/src/Model/Response/BulkResponse.php @@ -8,24 +8,24 @@ abstract class BulkResponse extends Response { /** - * @SWG\Property + * @OA\Property */ public $data; /** - * @SWG\Property(example=1, type="int") + * @OA\Property(example=1, type="int") * @var int */ public $count = 0; /** - * @SWG\Property() + * @OA\Property() * @var BulkError[] */ public $errors; /** - * @SWG\Property(example=200, type="int") + * @OA\Property(example=200, type="int") * @var int */ public $statusCode; diff --git a/src/Model/Response/ErrorResponse.php b/src/Model/Response/ErrorResponse.php index a62d1e4..d8363c3 100644 --- a/src/Model/Response/ErrorResponse.php +++ b/src/Model/Response/ErrorResponse.php @@ -5,30 +5,30 @@ use NYPL\Starter\Model\Response; /** - * @SWG\Definition(name="ErrorResponse", type="object") + * @OA\Schema(name="ErrorResponse", type="object") */ class ErrorResponse extends Response { /** - * @SWG\Property(format="int32") + * @OA\Property(format="int32") * @var int */ public $statusCode = 500; /** - * @SWG\Property(example="error_type") + * @OA\Property(example="error_type") * @var string */ public $type = ''; /** - * @SWG\Property(example="Description of error") + * @OA\Property(example="Description of error") * @var string */ public $message = ''; /** - * @SWG\Property(type="object") + * @OA\Property(type="object") * @var array */ public $error = []; diff --git a/src/Model/Response/SuccessResponse.php b/src/Model/Response/SuccessResponse.php index 7b24e17..c2df2b1 100644 --- a/src/Model/Response/SuccessResponse.php +++ b/src/Model/Response/SuccessResponse.php @@ -8,7 +8,7 @@ abstract class SuccessResponse extends Response { /** - * @SWG\Property + * @OA\Property */ public $data; From 1b28a165449d7cdfc30a8610d4192bbcf2d8f831 Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 17 Oct 2024 17:06:02 +0200 Subject: [PATCH 26/57] Removes setupDefaultRoutes() function. --- src/Service.php | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/Service.php b/src/Service.php index bffdaa6..08ff7ff 100644 --- a/src/Service.php +++ b/src/Service.php @@ -31,41 +31,5 @@ public function __construct(Container $container = null) $app->addBodyParsingMiddleware(); parent::__construct($app->getResponseFactory(), $container); - - $this->setupDefaultRoutes(); - } - - protected function setupDefaultRoutes() - { - $this->add(function (Request $request, Response $response, callable $next) { - $response = $next($request, $response); - return $response - ->withHeader( - "Access-Control-Allow-Headers", - "Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token" - ) - ->withHeader( - "Access-Control-Allow-Methods", - "GET, POST, PUT, PATCH, DELETE, OPTIONS" - ) - ->withHeader( - "Access-Control-Allow-Origin", - "*" - ) - ->withHeader( - "Access-Control-Allow-Credentials", - "true" - ) - ->withHeader('X-NYPL-Original-Request', $request->getUri()) - ->withHeader('X-NYPL-Response-Date', date('c')); - }); - - $this->options("[/{params:.*}]", function (Request $request, Response $response) { - return $response - ->withHeader( - "Cache-Control", - "public, max-age=" . self::CACHE_SECONDS_OPTIONS_REQUEST - ); - }); } } From b803557e4e433a93ea555523309e599c7b2efd0a Mon Sep 17 00:00:00 2001 From: Keith Bauer Date: Thu, 24 Oct 2024 14:16:05 -0500 Subject: [PATCH 27/57] Update error variable usage --- src/DefaultContainer.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/DefaultContainer.php b/src/DefaultContainer.php index 978aa36..164c341 100644 --- a/src/DefaultContainer.php +++ b/src/DefaultContainer.php @@ -12,6 +12,7 @@ class DefaultContainer extends Container { const DEFAULT_ERROR_STATUS_CODE = 500; + public $settings = []; /** * @param \Throwable $exception @@ -99,9 +100,9 @@ public function __construct( { parent::__construct($injectionFactory, $delegateContainer); - $this["settings"]["displayErrorDetails"] = false; + $this->settings["displayErrorDetails"] = false; - $this["notFoundHandler"] = function (Container $container) { + $this->notFoundHandler = function (Container $container) { return function (Request $request, Response $response) use ($container) { return $container["response"] ->withStatus(404) @@ -110,13 +111,13 @@ public function __construct( }; }; - $this['phpErrorHandler'] = function ($container) { + $this->phpErrorHandler = function ($container) { return function (Request $request, Response $response, \Throwable $exception) use ($container) { return $this->handleError($container, $request, $exception); }; }; - $this["errorHandler"] = function (Container $container) { + $this->errorHandler = function (Container $container) { return function (Request $request, Response $response, \Throwable $exception) use ($container) { return $this->handleError($container, $request, $exception); }; From 2ebe48650717c90f34c36b1590146a7f64c8d048 Mon Sep 17 00:00:00 2001 From: Keith Bauer Date: Thu, 24 Oct 2024 14:23:32 -0500 Subject: [PATCH 28/57] Fix settings const --- src/DefaultContainer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DefaultContainer.php b/src/DefaultContainer.php index 164c341..3d1c435 100644 --- a/src/DefaultContainer.php +++ b/src/DefaultContainer.php @@ -12,7 +12,7 @@ class DefaultContainer extends Container { const DEFAULT_ERROR_STATUS_CODE = 500; - public $settings = []; + const settings = []; /** * @param \Throwable $exception From 325b3c0a38488a46188185de69bf9fa5f336679d Mon Sep 17 00:00:00 2001 From: Keith Bauer Date: Mon, 28 Oct 2024 14:40:13 -0500 Subject: [PATCH 29/57] Fix nested arrays --- src/Model/ModelTrait/DBCreateTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/ModelTrait/DBCreateTrait.php b/src/Model/ModelTrait/DBCreateTrait.php index 0a3242a..452202a 100644 --- a/src/Model/ModelTrait/DBCreateTrait.php +++ b/src/Model/ModelTrait/DBCreateTrait.php @@ -83,7 +83,7 @@ protected function createDbRecord($useId = false) $insertStatement = DB::getDatabase()->insert(array_keys($insertValues)) ->into($this->getTableName()) - ->values(array_values($insertValues)); + ->values(...array_values($insertValues)); $insertStatement->execute(false); From 0416cb9efa0fa796b6c4f5562aa385cb39fbc1a6 Mon Sep 17 00:00:00 2001 From: John Berube Date: Fri, 6 Dec 2024 15:32:48 -0500 Subject: [PATCH 30/57] Updates response object to interface. --- src/SwaggerGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SwaggerGenerator.php b/src/SwaggerGenerator.php index 59509e5..9c88a3d 100644 --- a/src/SwaggerGenerator.php +++ b/src/SwaggerGenerator.php @@ -1,7 +1,7 @@ Date: Tue, 10 Dec 2024 12:33:17 -0500 Subject: [PATCH 31/57] Removes old avro-php library. --- avro-php-1.8.1/LICENSE | 203 ---- avro-php-1.8.1/NOTICE | 6 - avro-php-1.8.1/README.txt | 33 - avro-php-1.8.1/examples/write_read.php | 94 -- avro-php-1.8.1/lib/avro.php | 195 ---- avro-php-1.8.1/lib/avro/data_file.php | 537 --------- avro-php-1.8.1/lib/avro/datum.php | 990 ---------------- avro-php-1.8.1/lib/avro/debug.php | 194 ---- avro-php-1.8.1/lib/avro/gmp.php | 222 ---- avro-php-1.8.1/lib/avro/io.php | 494 -------- avro-php-1.8.1/lib/avro/protocol.php | 86 -- avro-php-1.8.1/lib/avro/schema.php | 1457 ------------------------ avro-php-1.8.1/lib/avro/util.php | 67 -- 13 files changed, 4578 deletions(-) delete mode 100644 avro-php-1.8.1/LICENSE delete mode 100644 avro-php-1.8.1/NOTICE delete mode 100644 avro-php-1.8.1/README.txt delete mode 100644 avro-php-1.8.1/examples/write_read.php delete mode 100644 avro-php-1.8.1/lib/avro.php delete mode 100644 avro-php-1.8.1/lib/avro/data_file.php delete mode 100644 avro-php-1.8.1/lib/avro/datum.php delete mode 100644 avro-php-1.8.1/lib/avro/debug.php delete mode 100644 avro-php-1.8.1/lib/avro/gmp.php delete mode 100644 avro-php-1.8.1/lib/avro/io.php delete mode 100644 avro-php-1.8.1/lib/avro/protocol.php delete mode 100644 avro-php-1.8.1/lib/avro/schema.php delete mode 100644 avro-php-1.8.1/lib/avro/util.php diff --git a/avro-php-1.8.1/LICENSE b/avro-php-1.8.1/LICENSE deleted file mode 100644 index 6b0b127..0000000 --- a/avro-php-1.8.1/LICENSE +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/avro-php-1.8.1/NOTICE b/avro-php-1.8.1/NOTICE deleted file mode 100644 index 646196a..0000000 --- a/avro-php-1.8.1/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -Apache Avro -Copyright 2010-2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - diff --git a/avro-php-1.8.1/README.txt b/avro-php-1.8.1/README.txt deleted file mode 100644 index 4106107..0000000 --- a/avro-php-1.8.1/README.txt +++ /dev/null @@ -1,33 +0,0 @@ -What the Avro PHP library is -============================ - -A library for using [Avro](http://avro.apache.org/) with PHP. - -Requirements -============ - * PHP 5 - * On 32-bit platforms, the [GMP PHP extension](http://php.net/gmp) - * For testing, [PHPUnit](http://www.phpunit.de/) - -Both GMP and PHPUnit are often available via package management -systems as `php5-gmp` and `phpunit`, respectively. - -Getting started -=============== - -Untar the avro-php distribution, untar it, and put it in your include path: - - tar xjf avro-php.tar.bz2 # avro-php.tar.bz2 is likely avro-php-1.4.0.tar.bz2 - cp avro-php /path/to/where/you/want/it - -Require the avro.php file in your source, and you should be good to go: - - 1392, 'member_name' => 'Jose'); -$maria = array('member_id' => 1642, 'member_name' => 'Maria'); -$data = array($jose, $maria); - -$file_name = 'data.avr'; -// Open $file_name for writing, using the given writer's schema -$data_writer = AvroDataIO::open_file($file_name, 'w', $writers_schema_json); - -// Write each datum to the file -foreach ($data as $datum) - $data_writer->append($datum); -// Tidy up -$data_writer->close(); - -// Open $file_name (by default for reading) using the writer's schema -// included in the file -$data_reader = AvroDataIO::open_file($file_name); -echo "from file:\n"; -// Read each datum -foreach ($data_reader->data() as $datum) - echo var_export($datum, true) . "\n"; -$data_reader->close(); - -// Create a data string -// Create a string io object. -$io = new AvroStringIO(); -// Create a datum writer object -$writers_schema = AvroSchema::parse($writers_schema_json); -$writer = new AvroIODatumWriter($writers_schema); -$data_writer = new AvroDataIOWriter($io, $writer, $writers_schema); -foreach ($data as $datum) - $data_writer->append($datum); -$data_writer->close(); - -$binary_string = $io->string(); - -// Load the string data string -$read_io = new AvroStringIO($binary_string); -$data_reader = new AvroDataIOReader($read_io, new AvroIODatumReader()); -echo "from binary string:\n"; -foreach ($data_reader->data() as $datum) - echo var_export($datum, true) . "\n"; - -/** Output -from file: -array ( - 'member_id' => 1392, - 'member_name' => 'Jose', -) -array ( - 'member_id' => 1642, - 'member_name' => 'Maria', -) -from binary string: -array ( - 'member_id' => 1392, - 'member_name' => 'Jose', -) -array ( - 'member_id' => 1642, - 'member_name' => 'Maria', -) -*/ diff --git a/avro-php-1.8.1/lib/avro.php b/avro-php-1.8.1/lib/avro.php deleted file mode 100644 index 4805fb7..0000000 --- a/avro-php-1.8.1/lib/avro.php +++ /dev/null @@ -1,195 +0,0 @@ -io = $io; - $this->decoder = new AvroIOBinaryDecoder($this->io); - $this->datum_reader = $datum_reader; - $this->read_header(); - - $codec = AvroUtil::array_value($this->metadata, - AvroDataIO::METADATA_CODEC_ATTR); - if ($codec && !AvroDataIO::is_valid_codec($codec)) - throw new AvroDataIOException(sprintf('Uknown codec: %s', $codec)); - - $this->block_count = 0; - // FIXME: Seems unsanitary to set writers_schema here. - // Can't constructor take it as an argument? - $this->datum_reader->set_writers_schema( - AvroSchema::parse($this->metadata[AvroDataIO::METADATA_SCHEMA_ATTR])); - } - - /** - * Reads header of object container - * @throws AvroDataIOException if the file is not an Avro data file. - */ - private function read_header() - { - $this->seek(0, AvroIO::SEEK_SET); - - $magic = $this->read(AvroDataIO::magic_size()); - - - - if (strlen($magic) < AvroDataIO::magic_size()) - throw new AvroDataIOException( - 'Not an Avro data file: shorter than the Avro magic block'); - - if (AvroDataIO::magic() != $magic) - throw new AvroDataIOException( - sprintf('Not an Avro data file: %s does not match %s', - $magic, AvroDataIO::magic())); - - $this->metadata = $this->datum_reader->read_data(AvroDataIO::metadata_schema(), - AvroDataIO::metadata_schema(), - $this->decoder); - $this->sync_marker = $this->read(AvroDataIO::SYNC_SIZE); - } - - /** - * @internal Would be nice to implement data() as an iterator, I think - * @returns array of data from object container. - */ - public function data() - { - $data = array(); - while (true) - { - if (0 == $this->block_count) - { - if ($this->is_eof()) - break; - - if ($this->skip_sync()) - if ($this->is_eof()) - break; - - $this->read_block_header(); - } - $data []= $this->datum_reader->read($this->decoder); - $this->block_count -= 1; - } - return $data; - } - - /** - * Closes this writer (and its AvroIO object.) - * @uses AvroIO::close() - */ - public function close() { return $this->io->close(); } - - /** - * @uses AvroIO::seek() - */ - private function seek($offset, $whence) - { - return $this->io->seek($offset, $whence); - } - - /** - * @uses AvroIO::read() - */ - private function read($len) { return $this->io->read($len); } - - /** - * @uses AvroIO::is_eof() - */ - private function is_eof() { return $this->io->is_eof(); } - - private function skip_sync() - { - $proposed_sync_marker = $this->read(AvroDataIO::SYNC_SIZE); - if ($proposed_sync_marker != $this->sync_marker) - { - $this->seek(-AvroDataIO::SYNC_SIZE, AvroIO::SEEK_CUR); - return false; - } - return true; - } - - /** - * Reads the block header (which includes the count of items in the block - * and the length in bytes of the block) - * @returns int length in bytes of the block. - */ - private function read_block_header() - { - $this->block_count = $this->decoder->read_long(); - return $this->decoder->read_long(); - } - -} - -/** - * Writes Avro data to an AvroIO source using an AvroSchema - * @package Avro - */ -class AvroDataIOWriter -{ - /** - * @returns string a new, unique sync marker. - */ - private static function generate_sync_marker() - { - // From http://php.net/manual/en/function.mt-rand.php comments - return pack('S8', - mt_rand(0, 0xffff), mt_rand(0, 0xffff), - mt_rand(0, 0xffff), - mt_rand(0, 0xffff) | 0x4000, - mt_rand(0, 0xffff) | 0x8000, - mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)); - } - - /** - * @var AvroIO object container where data is written - */ - private $io; - - /** - * @var AvroIOBinaryEncoder encoder for object container - */ - private $encoder; - - /** - * @var AvroDatumWriter - */ - private $datum_writer; - - /** - * @var AvroStringIO buffer for writing - */ - private $buffer; - - /** - * @var AvroIOBinaryEncoder encoder for buffer - */ - private $buffer_encoder; // AvroIOBinaryEncoder - - /** - * @var int count of items written to block - */ - private $block_count; - - /** - * @var array map of object container metadata - */ - private $metadata; - - /** - * @param AvroIO $io - * @param AvroIODatumWriter $datum_writer - * @param AvroSchema $writers_schema - */ - public function __construct($io, $datum_writer, $writers_schema=null) - { - if (!($io instanceof AvroIO)) - throw new AvroDataIOException('io must be instance of AvroIO'); - - $this->io = $io; - $this->encoder = new AvroIOBinaryEncoder($this->io); - $this->datum_writer = $datum_writer; - $this->buffer = new AvroStringIO(); - $this->buffer_encoder = new AvroIOBinaryEncoder($this->buffer); - $this->block_count = 0; - $this->metadata = array(); - - if ($writers_schema) - { - $this->sync_marker = self::generate_sync_marker(); - $this->metadata[AvroDataIO::METADATA_CODEC_ATTR] = AvroDataIO::NULL_CODEC; - $this->metadata[AvroDataIO::METADATA_SCHEMA_ATTR] = strval($writers_schema); - $this->write_header(); - } - else - { - $dfr = new AvroDataIOReader($this->io, new AvroIODatumReader()); - $this->sync_marker = $dfr->sync_marker; - $this->metadata[AvroDataIO::METADATA_CODEC_ATTR] = $dfr->metadata[AvroDataIO::METADATA_CODEC_ATTR]; - - $schema_from_file = $dfr->metadata[AvroDataIO::METADATA_SCHEMA_ATTR]; - $this->metadata[AvroDataIO::METADATA_SCHEMA_ATTR] = $schema_from_file; - $this->datum_writer->writers_schema = AvroSchema::parse($schema_from_file); - $this->seek(0, SEEK_END); - } - } - - /** - * @param mixed $datum - */ - public function append($datum) - { - $this->datum_writer->write($datum, $this->buffer_encoder); - $this->block_count++; - - if ($this->buffer->length() >= AvroDataIO::SYNC_INTERVAL) - $this->write_block(); - } - - /** - * Flushes buffer to AvroIO object container and closes it. - * @return mixed value of $io->close() - * @see AvroIO::close() - */ - public function close() - { - $this->flush(); - return $this->io->close(); - } - - /** - * Flushes biffer to AvroIO object container. - * @returns mixed value of $io->flush() - * @see AvroIO::flush() - */ - private function flush() - { - $this->write_block(); - return $this->io->flush(); - } - - /** - * Writes a block of data to the AvroIO object container. - * @throws AvroDataIOException if the codec provided by the encoder - * is not supported - * @internal Should the codec check happen in the constructor? - * Why wait until we're writing data? - */ - private function write_block() - { - if ($this->block_count > 0) - { - $this->encoder->write_long($this->block_count); - $to_write = strval($this->buffer); - $this->encoder->write_long(strlen($to_write)); - - if (AvroDataIO::is_valid_codec( - $this->metadata[AvroDataIO::METADATA_CODEC_ATTR])) - $this->write($to_write); - else - throw new AvroDataIOException( - sprintf('codec %s is not supported', - $this->metadata[AvroDataIO::METADATA_CODEC_ATTR])); - - $this->write($this->sync_marker); - $this->buffer->truncate(); - $this->block_count = 0; - } - } - - /** - * Writes the header of the AvroIO object container - */ - private function write_header() - { - $this->write(AvroDataIO::magic()); - $this->datum_writer->write_data(AvroDataIO::metadata_schema(), - $this->metadata, $this->encoder); - $this->write($this->sync_marker); - } - - /** - * @param string $bytes - * @uses AvroIO::write() - */ - private function write($bytes) { return $this->io->write($bytes); } - - /** - * @param int $offset - * @param int $whence - * @uses AvroIO::seek() - */ - private function seek($offset, $whence) - { - return $this->io->seek($offset, $whence); - } -} diff --git a/avro-php-1.8.1/lib/avro/datum.php b/avro-php-1.8.1/lib/avro/datum.php deleted file mode 100644 index 3d10e1a..0000000 --- a/avro-php-1.8.1/lib/avro/datum.php +++ /dev/null @@ -1,990 +0,0 @@ -writers_schema = $writers_schema; - } - - /** - * @param AvroSchema $writers_schema - * @param $datum - * @param AvroIOBinaryEncoder $encoder - * @returns mixed - * - * @throws AvroIOTypeException if $datum is invalid for $writers_schema - */ - function write_data($writers_schema, $datum, $encoder) - { - if (!AvroSchema::is_valid_datum($writers_schema, $datum)) - throw new AvroIOTypeException($writers_schema, $datum); - - switch ($writers_schema->type()) - { - case AvroSchema::NULL_TYPE: - return $encoder->write_null($datum); - case AvroSchema::BOOLEAN_TYPE: - return $encoder->write_boolean($datum); - case AvroSchema::INT_TYPE: - return $encoder->write_int($datum); - case AvroSchema::LONG_TYPE: - return $encoder->write_long($datum); - case AvroSchema::FLOAT_TYPE: - return $encoder->write_float($datum); - case AvroSchema::DOUBLE_TYPE: - return $encoder->write_double($datum); - case AvroSchema::STRING_TYPE: - return $encoder->write_string($datum); - case AvroSchema::BYTES_TYPE: - return $encoder->write_bytes($datum); - case AvroSchema::ARRAY_SCHEMA: - return $this->write_array($writers_schema, $datum, $encoder); - case AvroSchema::MAP_SCHEMA: - return $this->write_map($writers_schema, $datum, $encoder); - case AvroSchema::FIXED_SCHEMA: - return $this->write_fixed($writers_schema, $datum, $encoder); - case AvroSchema::ENUM_SCHEMA: - return $this->write_enum($writers_schema, $datum, $encoder); - case AvroSchema::RECORD_SCHEMA: - case AvroSchema::ERROR_SCHEMA: - case AvroSchema::REQUEST_SCHEMA: - return $this->write_record($writers_schema, $datum, $encoder); - case AvroSchema::UNION_SCHEMA: - return $this->write_union($writers_schema, $datum, $encoder); - default: - throw new AvroException(sprintf('Uknown type: %s', - $writers_schema->type)); - } - } - - /** - * @param $datum - * @param AvroIOBinaryEncoder $encoder - */ - function write($datum, $encoder) - { - $this->write_data($this->writers_schema, $datum, $encoder); - } - - /**#@+ - * @param AvroSchema $writers_schema - * @param null|boolean|int|float|string|array $datum item to be written - * @param AvroIOBinaryEncoder $encoder - */ - private function write_array($writers_schema, $datum, $encoder) - { - $datum_count = count($datum); - if (0 < $datum_count) - { - $encoder->write_long($datum_count); - $items = $writers_schema->items(); - foreach ($datum as $item) - $this->write_data($items, $item, $encoder); - } - return $encoder->write_long(0); - } - - private function write_map($writers_schema, $datum, $encoder) - { - $datum_count = count($datum); - if ($datum_count > 0) - { - $encoder->write_long($datum_count); - foreach ($datum as $k => $v) - { - $encoder->write_string($k); - $this->write_data($writers_schema->values(), $v, $encoder); - } - } - $encoder->write_long(0); - } - - private function write_union($writers_schema, $datum, $encoder) - { - $datum_schema_index = -1; - $datum_schema = null; - foreach ($writers_schema->schemas() as $index => $schema) - if (AvroSchema::is_valid_datum($schema, $datum)) - { - $datum_schema_index = $index; - $datum_schema = $schema; - break; - } - - if (is_null($datum_schema)) - throw new AvroIOTypeException($writers_schema, $datum); - - $encoder->write_long($datum_schema_index); - $this->write_data($datum_schema, $datum, $encoder); - } - - private function write_enum($writers_schema, $datum, $encoder) - { - $datum_index = $writers_schema->symbol_index($datum); - return $encoder->write_int($datum_index); - } - - private function write_fixed($writers_schema, $datum, $encoder) - { - /** - * NOTE Unused $writers_schema parameter included for consistency - * with other write_* methods. - */ - return $encoder->write($datum); - } - - private function write_record($writers_schema, $datum, $encoder) - { - /** - * @var $field AvroField - */ - foreach ($writers_schema->fields() as $field) { - $value = isset($datum[$field->name()]) ? $datum[$field->name()] : $field->default_value(); - - $this->write_data($field->type(), $value, $encoder); - } - } - - /**#@-*/ -} - -/** - * Encodes and writes Avro data to an AvroIO object using - * Avro binary encoding. - * - * @package Avro - */ -class AvroIOBinaryEncoder -{ - /** - * Performs encoding of the given float value to a binary string - * - * XXX: This is not endian-aware! The {@link Avro::check_platform()} - * called in {@link AvroIOBinaryEncoder::__construct()} should ensure the - * library is only used on little-endian platforms, which ensure the little-endian - * encoding required by the Avro spec. - * - * @param float $float - * @returns string bytes - * @see Avro::check_platform() - */ - static function float_to_int_bits($float) - { - return pack('f', (float) $float); - } - - /** - * Performs encoding of the given double value to a binary string - * - * XXX: This is not endian-aware! See comments in - * {@link AvroIOBinaryEncoder::float_to_int_bits()} for details. - * - * @param double $double - * @returns string bytes - */ - static function double_to_long_bits($double) - { - return pack('d', (double) $double); - } - - /** - * @param int|string $n - * @returns string long $n encoded as bytes - * @internal This relies on 64-bit PHP. - */ - static public function encode_long($n) - { - $n = (int) $n; - $n = ($n << 1) ^ ($n >> 63); - $str = ''; - while (0 != ($n & ~0x7F)) - { - $str .= chr(($n & 0x7F) | 0x80); - $n >>= 7; - } - $str .= chr($n); - return $str; - } - - /** - * @var AvroIO - */ - private $io; - - /** - * @param AvroIO $io object to which data is to be written. - * - */ - function __construct($io) - { - Avro::check_platform(); - $this->io = $io; - } - - /** - * @param null $datum actual value is ignored - */ - function write_null($datum) { return null; } - - /** - * @param boolean $datum - */ - function write_boolean($datum) - { - $byte = $datum ? chr(1) : chr(0); - $this->write($byte); - } - - /** - * @param int $datum - */ - function write_int($datum) { $this->write_long($datum); } - - /** - * @param int $n - */ - function write_long($n) - { - if (Avro::uses_gmp()) - $this->write(AvroGMP::encode_long($n)); - else - $this->write(self::encode_long($n)); - } - - /** - * @param float $datum - * @uses self::float_to_int_bits() - */ - public function write_float($datum) - { - $this->write(self::float_to_int_bits($datum)); - } - - /** - * @param float $datum - * @uses self::double_to_long_bits() - */ - public function write_double($datum) - { - $this->write(self::double_to_long_bits($datum)); - } - - /** - * @param string $str - * @uses self::write_bytes() - */ - function write_string($str) { $this->write_bytes($str); } - - /** - * @param string $bytes - */ - function write_bytes($bytes) - { - $this->write_long(strlen($bytes)); - $this->write($bytes); - } - - /** - * @param string $datum - */ - function write($datum) { $this->io->write($datum); } -} - -/** - * Handles schema-specifc reading of data from the decoder. - * - * Also handles schema resolution between the reader and writer - * schemas (if a writer's schema is provided). - * - * @package Avro - */ -class AvroIODatumReader -{ - /** - * - * @param AvroSchema $writers_schema - * @param AvroSchema $readers_schema - * @returns boolean true if the schemas are consistent with - * each other and false otherwise. - */ - static function schemas_match($writers_schema, $readers_schema) - { - $writers_schema_type = $writers_schema->type; - $readers_schema_type = $readers_schema->type; - - if (AvroSchema::UNION_SCHEMA == $writers_schema_type - || AvroSchema::UNION_SCHEMA == $readers_schema_type) - return true; - - if ($writers_schema_type == $readers_schema_type) - { - if (AvroSchema::is_primitive_type($writers_schema_type)) - return true; - - switch ($readers_schema_type) - { - case AvroSchema::MAP_SCHEMA: - return self::attributes_match($writers_schema->values(), - $readers_schema->values(), - array(AvroSchema::TYPE_ATTR)); - case AvroSchema::ARRAY_SCHEMA: - return self::attributes_match($writers_schema->items(), - $readers_schema->items(), - array(AvroSchema::TYPE_ATTR)); - case AvroSchema::ENUM_SCHEMA: - return self::attributes_match($writers_schema, $readers_schema, - array(AvroSchema::FULLNAME_ATTR)); - case AvroSchema::FIXED_SCHEMA: - return self::attributes_match($writers_schema, $readers_schema, - array(AvroSchema::FULLNAME_ATTR, - AvroSchema::SIZE_ATTR)); - case AvroSchema::RECORD_SCHEMA: - case AvroSchema::ERROR_SCHEMA: - return self::attributes_match($writers_schema, $readers_schema, - array(AvroSchema::FULLNAME_ATTR)); - case AvroSchema::REQUEST_SCHEMA: - // XXX: This seems wrong - return true; - // XXX: no default - } - - if (AvroSchema::INT_TYPE == $writers_schema_type - && in_array($readers_schema_type, array(AvroSchema::LONG_TYPE, - AvroSchema::FLOAT_TYPE, - AvroSchema::DOUBLE_TYPE))) - return true; - - if (AvroSchema::LONG_TYPE == $writers_schema_type - && in_array($readers_schema_type, array(AvroSchema::FLOAT_TYPE, - AvroSchema::DOUBLE_TYPE))) - return true; - - if (AvroSchema::FLOAT_TYPE == $writers_schema_type - && AvroSchema::DOUBLE_TYPE == $readers_schema_type) - return true; - - return false; - } - - } - - /** - * Checks equivalence of the given attributes of the two given schemas. - * - * @param AvroSchema $schema_one - * @param AvroSchema $schema_two - * @param string[] $attribute_names array of string attribute names to compare - * - * @returns boolean true if the attributes match and false otherwise. - */ - static function attributes_match($schema_one, $schema_two, $attribute_names) - { - foreach ($attribute_names as $attribute_name) - if ($schema_one->attribute($attribute_name) - != $schema_two->attribute($attribute_name)) - return false; - return true; - } - - /** - * @var AvroSchema - */ - private $writers_schema; - - /** - * @var AvroSchema - */ - private $readers_schema; - - /** - * @param AvroSchema $writers_schema - * @param AvroSchema $readers_schema - */ - function __construct($writers_schema=null, $readers_schema=null) - { - $this->writers_schema = $writers_schema; - $this->readers_schema = $readers_schema; - } - - /** - * @param AvroSchema $readers_schema - */ - public function set_writers_schema($readers_schema) - { - $this->writers_schema = $readers_schema; - } - - /** - * @param AvroIOBinaryDecoder $decoder - * @returns string - */ - public function read($decoder) - { - if (is_null($this->readers_schema)) - $this->readers_schema = $this->writers_schema; - return $this->read_data($this->writers_schema, $this->readers_schema, - $decoder); - } - - /**#@+ - * @param AvroSchema $writers_schema - * @param AvroSchema $readers_schema - * @param AvroIOBinaryDecoder $decoder - */ - /** - * @returns mixed - */ - public function read_data($writers_schema, $readers_schema, $decoder) - { - if (!self::schemas_match($writers_schema, $readers_schema)) - throw new AvroIOSchemaMatchException($writers_schema, $readers_schema); - - // Schema resolution: reader's schema is a union, writer's schema is not - if (AvroSchema::UNION_SCHEMA == $readers_schema->type() - && AvroSchema::UNION_SCHEMA != $writers_schema->type()) - { - foreach ($readers_schema->schemas() as $schema) - if (self::schemas_match($writers_schema, $schema)) - return $this->read_data($writers_schema, $schema, $decoder); - throw new AvroIOSchemaMatchException($writers_schema, $readers_schema); - } - - switch ($writers_schema->type()) - { - case AvroSchema::NULL_TYPE: - return $decoder->read_null(); - case AvroSchema::BOOLEAN_TYPE: - return $decoder->read_boolean(); - case AvroSchema::INT_TYPE: - return $decoder->read_int(); - case AvroSchema::LONG_TYPE: - return $decoder->read_long(); - case AvroSchema::FLOAT_TYPE: - return $decoder->read_float(); - case AvroSchema::DOUBLE_TYPE: - return $decoder->read_double(); - case AvroSchema::STRING_TYPE: - return $decoder->read_string(); - case AvroSchema::BYTES_TYPE: - return $decoder->read_bytes(); - case AvroSchema::ARRAY_SCHEMA: - return $this->read_array($writers_schema, $readers_schema, $decoder); - case AvroSchema::MAP_SCHEMA: - return $this->read_map($writers_schema, $readers_schema, $decoder); - case AvroSchema::UNION_SCHEMA: - return $this->read_union($writers_schema, $readers_schema, $decoder); - case AvroSchema::ENUM_SCHEMA: - return $this->read_enum($writers_schema, $readers_schema, $decoder); - case AvroSchema::FIXED_SCHEMA: - return $this->read_fixed($writers_schema, $readers_schema, $decoder); - case AvroSchema::RECORD_SCHEMA: - case AvroSchema::ERROR_SCHEMA: - case AvroSchema::REQUEST_SCHEMA: - return $this->read_record($writers_schema, $readers_schema, $decoder); - default: - throw new AvroException(sprintf("Cannot read unknown schema type: %s", - $writers_schema->type())); - } - } - - /** - * @returns array - */ - public function read_array($writers_schema, $readers_schema, $decoder) - { - $items = array(); - $block_count = $decoder->read_long(); - while (0 != $block_count) - { - if ($block_count < 0) - { - $block_count = -$block_count; - $block_size = $decoder->read_long(); // Read (and ignore) block size - } - for ($i = 0; $i < $block_count; $i++) - $items []= $this->read_data($writers_schema->items(), - $readers_schema->items(), - $decoder); - $block_count = $decoder->read_long(); - } - return $items; - } - - /** - * @returns array - */ - public function read_map($writers_schema, $readers_schema, $decoder) - { - $items = array(); - $pair_count = $decoder->read_long(); - while (0 != $pair_count) - { - if ($pair_count < 0) - { - $pair_count = -$pair_count; - // Note: we're not doing anything with block_size other than skipping it - $block_size = $decoder->read_long(); - } - - for ($i = 0; $i < $pair_count; $i++) - { - $key = $decoder->read_string(); - $items[$key] = $this->read_data($writers_schema->values(), - $readers_schema->values(), - $decoder); - } - $pair_count = $decoder->read_long(); - } - return $items; - } - - /** - * @returns mixed - */ - public function read_union($writers_schema, $readers_schema, $decoder) - { - $schema_index = $decoder->read_long(); - $selected_writers_schema = $writers_schema->schema_by_index($schema_index); - return $this->read_data($selected_writers_schema, $readers_schema, $decoder); - } - - /** - * @returns string - */ - public function read_enum($writers_schema, $readers_schema, $decoder) - { - $symbol_index = $decoder->read_int(); - $symbol = $writers_schema->symbol_by_index($symbol_index); - if (!$readers_schema->has_symbol($symbol)) - null; // FIXME: unset wrt schema resolution - return $symbol; - } - - /** - * @returns string - */ - public function read_fixed($writers_schema, $readers_schema, $decoder) - { - return $decoder->read($writers_schema->size()); - } - - /** - * @returns array - */ - public function read_record($writers_schema, $readers_schema, $decoder) - { - $readers_fields = $readers_schema->fields_hash(); - $record = array(); - foreach ($writers_schema->fields() as $writers_field) - { - $type = $writers_field->type(); - if (isset($readers_fields[$writers_field->name()])) - $record[$writers_field->name()] - = $this->read_data($type, - $readers_fields[$writers_field->name()]->type(), - $decoder); - else - $this->skip_data($type, $decoder); - } - // Fill in default values - if (count($readers_fields) > count($record)) - { - $writers_fields = $writers_schema->fields_hash(); - foreach ($readers_fields as $field_name => $field) - { - if (!isset($writers_fields[$field_name])) - { - if ($field->has_default_value()) - $record[$field->name()] - = $this->read_default_value($field->type(), - $field->default_value()); - else - null; // FIXME: unset - } - } - } - - return $record; - } - /**#@-*/ - - /** - * @param AvroSchema $field_schema - * @param null|boolean|int|float|string|array $default_value - * @returns null|boolean|int|float|string|array - * - * @throws AvroException if $field_schema type is unknown. - */ - public function read_default_value($field_schema, $default_value) - { - switch($field_schema->type()) - { - case AvroSchema::NULL_TYPE: - return null; - case AvroSchema::BOOLEAN_TYPE: - return $default_value; - case AvroSchema::INT_TYPE: - case AvroSchema::LONG_TYPE: - return (int) $default_value; - case AvroSchema::FLOAT_TYPE: - case AvroSchema::DOUBLE_TYPE: - return (float) $default_value; - case AvroSchema::STRING_TYPE: - case AvroSchema::BYTES_TYPE: - return $default_value; - case AvroSchema::ARRAY_SCHEMA: - $array = array(); - foreach ($default_value as $json_val) - { - $val = $this->read_default_value($field_schema->items(), $json_val); - $array []= $val; - } - return $array; - case AvroSchema::MAP_SCHEMA: - $map = array(); - foreach ($default_value as $key => $json_val) - $map[$key] = $this->read_default_value($field_schema->values(), - $json_val); - return $map; - case AvroSchema::UNION_SCHEMA: - return $this->read_default_value($field_schema->schema_by_index(0), - $default_value); - case AvroSchema::ENUM_SCHEMA: - case AvroSchema::FIXED_SCHEMA: - return $default_value; - case AvroSchema::RECORD_SCHEMA: - $record = array(); - foreach ($field_schema->fields() as $field) - { - $field_name = $field->name(); - if (!$json_val = $default_value[$field_name]) - $json_val = $field->default_value(); - - $record[$field_name] = $this->read_default_value($field->type(), - $json_val); - } - return $record; - default: - throw new AvroException(sprintf('Unknown type: %s', $field_schema->type())); - } - } - - /** - * @param AvroSchema $writers_schema - * @param AvroIOBinaryDecoder $decoder - */ - private function skip_data($writers_schema, $decoder) - { - switch ($writers_schema->type()) - { - case AvroSchema::NULL_TYPE: - return $decoder->skip_null(); - case AvroSchema::BOOLEAN_TYPE: - return $decoder->skip_boolean(); - case AvroSchema::INT_TYPE: - return $decoder->skip_int(); - case AvroSchema::LONG_TYPE: - return $decoder->skip_long(); - case AvroSchema::FLOAT_TYPE: - return $decoder->skip_float(); - case AvroSchema::DOUBLE_TYPE: - return $decoder->skip_double(); - case AvroSchema::STRING_TYPE: - return $decoder->skip_string(); - case AvroSchema::BYTES_TYPE: - return $decoder->skip_bytes(); - case AvroSchema::ARRAY_SCHEMA: - return $decoder->skip_array($writers_schema, $decoder); - case AvroSchema::MAP_SCHEMA: - return $decoder->skip_map($writers_schema, $decoder); - case AvroSchema::UNION_SCHEMA: - return $decoder->skip_union($writers_schema, $decoder); - case AvroSchema::ENUM_SCHEMA: - return $decoder->skip_enum($writers_schema, $decoder); - case AvroSchema::FIXED_SCHEMA: - return $decoder->skip_fixed($writers_schema, $decoder); - case AvroSchema::RECORD_SCHEMA: - case AvroSchema::ERROR_SCHEMA: - case AvroSchema::REQUEST_SCHEMA: - return $decoder->skip_record($writers_schema, $decoder); - default: - throw new AvroException(sprintf('Uknown schema type: %s', - $writers_schema->type())); - } - } -} - -/** - * Decodes and reads Avro data from an AvroIO object encoded using - * Avro binary encoding. - * - * @package Avro - */ -class AvroIOBinaryDecoder -{ - - /** - * @param int[] array of byte ascii values - * @returns long decoded value - * @internal Requires 64-bit platform - */ - public static function decode_long_from_array($bytes) - { - $b = array_shift($bytes); - $n = $b & 0x7f; - $shift = 7; - while (0 != ($b & 0x80)) - { - $b = array_shift($bytes); - $n |= (($b & 0x7f) << $shift); - $shift += 7; - } - return (($n >> 1) ^ -($n & 1)); - } - - /** - * Performs decoding of the binary string to a float value. - * - * XXX: This is not endian-aware! See comments in - * {@link AvroIOBinaryEncoder::float_to_int_bits()} for details. - * - * @param string $bits - * @returns float - */ - static public function int_bits_to_float($bits) - { - $float = unpack('f', $bits); - return (float) $float[1]; - } - - /** - * Performs decoding of the binary string to a double value. - * - * XXX: This is not endian-aware! See comments in - * {@link AvroIOBinaryEncoder::float_to_int_bits()} for details. - * - * @param string $bits - * @returns float - */ - static public function long_bits_to_double($bits) - { - $double = unpack('d', $bits); - return (double) $double[1]; - } - - /** - * @var AvroIO - */ - private $io; - - /** - * @param AvroIO $io object from which to read. - */ - public function __construct($io) - { - Avro::check_platform(); - $this->io = $io; - } - - /** - * @returns string the next byte from $this->io. - * @throws AvroException if the next byte cannot be read. - */ - private function next_byte() { return $this->read(1); } - - /** - * @returns null - */ - public function read_null() { return null; } - - /** - * @returns boolean - */ - public function read_boolean() - { - return (boolean) (1 == ord($this->next_byte())); - } - - /** - * @returns int - */ - public function read_int() { return (int) $this->read_long(); } - - /** - * @returns long - */ - public function read_long() - { - $byte = ord($this->next_byte()); - $bytes = array($byte); - while (0 != ($byte & 0x80)) - { - $byte = ord($this->next_byte()); - $bytes []= $byte; - } - - if (Avro::uses_gmp()) - return AvroGMP::decode_long_from_array($bytes); - - return self::decode_long_from_array($bytes); - } - - /** - * @returns float - */ - public function read_float() - { - return self::int_bits_to_float($this->read(4)); - } - - /** - * @returns double - */ - public function read_double() - { - return self::long_bits_to_double($this->read(8)); - } - - /** - * A string is encoded as a long followed by that many bytes - * of UTF-8 encoded character data. - * @returns string - */ - public function read_string() { return $this->read_bytes(); } - - /** - * @returns string - */ - public function read_bytes() { return $this->read($this->read_long()); } - - /** - * @param int $len count of bytes to read - * @returns string - */ - public function read($len) { return $this->io->read($len); } - - public function skip_null() { return null; } - - public function skip_boolean() { return $this->skip(1); } - - public function skip_int() { return $this->skip_long(); } - - protected function skip_long() - { - $b = $this->next_byte(); - while (0 != ($b & 0x80)) - $b = $this->next_byte(); - } - - public function skip_float() { return $this->skip(4); } - - public function skip_double() { return $this->skip(8); } - - public function skip_bytes() { return $this->skip($this->read_long()); } - - public function skip_string() { return $this->skip_bytes(); } - - /** - * @param int $len count of bytes to skip - * @uses AvroIO::seek() - */ - public function skip($len) { $this->seek($len, AvroIO::SEEK_CUR); } - - /** - * @returns int position of pointer in AvroIO instance - * @uses AvroIO::tell() - */ - private function tell() { return $this->io->tell(); } - - /** - * @param int $offset - * @param int $whence - * @returns boolean true upon success - * @uses AvroIO::seek() - */ - private function seek($offset, $whence) - { - return $this->io->seek($offset, $whence); - } -} - diff --git a/avro-php-1.8.1/lib/avro/debug.php b/avro-php-1.8.1/lib/avro/debug.php deleted file mode 100644 index 2278f19..0000000 --- a/avro-php-1.8.1/lib/avro/debug.php +++ /dev/null @@ -1,194 +0,0 @@ -= $debug_level); - } - - /** - * @param string $format format string for the given arguments. Passed as is - * to vprintf. - * @param array $args array of arguments to pass to vsprinf. - * @param int $debug_level debug level at which to print this statement - * @returns boolean true - */ - static function debug($format, $args, $debug_level=self::DEBUG1) - { - if (self::is_debug($debug_level)) - vprintf($format . "\n", $args); - return true; - } - - /** - * @param string $str - * @returns string[] array of hex representation of each byte of $str - */ - static function hex_array($str) { return self::bytes_array($str); } - - /** - * @param string $str - * @param string $joiner string used to join - * @returns string hex-represented bytes of each byte of $str - joined by $joiner - */ - static function hex_string($str, $joiner=' ') - { - return join($joiner, self::hex_array($str)); - } - - /** - * @param string $str - * @param string $format format to represent bytes - * @returns string[] array of each byte of $str formatted using $format - */ - static function bytes_array($str, $format='x%02x') - { - $x = array(); - foreach (str_split($str) as $b) - $x []= sprintf($format, ord($b)); - return $x; - } - - /** - * @param string $str - * @returns string[] array of bytes of $str represented in decimal format ('%3d') - */ - static function dec_array($str) { return self::bytes_array($str, '%3d'); } - - /** - * @param string $str - * @param string $joiner string to join bytes of $str - * @returns string of bytes of $str represented in decimal format - * @uses dec_array() - */ - static function dec_string($str, $joiner = ' ') - { - return join($joiner, self::dec_array($str)); - } - - /** - * @param string $str - * @param string $format one of 'ctrl', 'hex', or 'dec' for control, - hexadecimal, or decimal format for bytes. - - ctrl: ASCII control characters represented as text. - For example, the null byte is represented as 'NUL'. - Visible ASCII characters represent themselves, and - others are represented as a decimal ('%03d') - - hex: bytes represented in hexadecimal ('%02X') - - dec: bytes represented in decimal ('%03d') - * @returns string[] array of bytes represented in the given format. - */ - static function ascii_array($str, $format='ctrl') - { - if (!in_array($format, array('ctrl', 'hex', 'dec'))) - throw new AvroException('Unrecognized format specifier'); - - $ctrl_chars = array('NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', - 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', - 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', - 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US'); - $x = array(); - foreach (str_split($str) as $b) - { - $db = ord($b); - if ($db < 32) - { - switch ($format) - { - case 'ctrl': - $x []= str_pad($ctrl_chars[$db], 3, ' ', STR_PAD_LEFT); - break; - case 'hex': - $x []= sprintf("x%02X", $db); - break; - case 'dec': - $x []= str_pad($db, 3, '0', STR_PAD_LEFT); - break; - } - } - else if ($db < 127) - $x []= " $b"; - else if ($db == 127) - { - switch ($format) - { - case 'ctrl': - $x []= 'DEL'; - break; - case 'hex': - $x []= sprintf("x%02X", $db); - break; - case 'dec': - $x []= str_pad($db, 3, '0', STR_PAD_LEFT); - break; - } - } - else - if ('hex' == $format) - $x []= sprintf("x%02X", $db); - else - $x []= str_pad($db, 3, '0', STR_PAD_LEFT); - } - return $x; - } - - /** - * @param string $str - * @param string $format one of 'ctrl', 'hex', or 'dec'. - * See {@link self::ascii_array()} for more description - * @param string $joiner - * @returns string of bytes joined by $joiner - * @uses ascii_array() - */ - static function ascii_string($str, $format='ctrl', $joiner = ' ') - { - return join($joiner, self::ascii_array($str, $format)); - } -} diff --git a/avro-php-1.8.1/lib/avro/gmp.php b/avro-php-1.8.1/lib/avro/gmp.php deleted file mode 100644 index 3d41d03..0000000 --- a/avro-php-1.8.1/lib/avro/gmp.php +++ /dev/null @@ -1,222 +0,0 @@ - gmp_sign($g)) - $g = self::gmp_twos_complement($g); - - $m = gmp_mul($g, gmp_pow(self::gmp_2(), $shift)); - $m = gmp_and($m, self::gmp_0xfs()); - if (gmp_testbit($m, 63)) - $m = gmp_neg(gmp_add(gmp_and(gmp_com($m), self::gmp_0xfs()), - self::gmp_1())); - return $m; - } - - /** - * Arithmetic right shift - * @param resource|int|string $g - * @param int $shift number of bits to shift right - * @returns resource $g shifted right $shift bits - */ - static function shift_right($g, $shift) - { - if (0 == $shift) - return $g; - - if (0 <= gmp_sign($g)) - $m = gmp_div($g, gmp_pow(self::gmp_2(), $shift)); - else // negative - { - $g = gmp_and($g, self::gmp_0xfs()); - $m = gmp_div($g, gmp_pow(self::gmp_2(), $shift)); - $m = gmp_and($m, self::gmp_0xfs()); - for ($i = 63; $i >= (63 - $shift); $i--) - gmp_setbit($m, $i); - - $m = gmp_neg(gmp_add(gmp_and(gmp_com($m), self::gmp_0xfs()), - self::gmp_1())); - } - - return $m; - } - - /** - * @param int|str $n integer (or string representation of integer) to encode - * @return string $bytes of the long $n encoded per the Avro spec - */ - static function encode_long($n) - { - $g = gmp_init($n); - $g = gmp_xor(self::shift_left($g, 1), - self::shift_right($g, 63)); - $bytes = ''; - while (0 != gmp_cmp(self::gmp_0(), gmp_and($g, self::gmp_n0x7f()))) - { - $bytes .= chr(gmp_intval(gmp_and($g, self::gmp_0x7f())) | 0x80); - $g = self::shift_right($g, 7); - } - $bytes .= chr(gmp_intval($g)); - return $bytes; - } - - /** - * @param int[] $bytes array of ascii codes of bytes to decode - * @return string represenation of decoded long. - */ - static function decode_long_from_array($bytes) - { - $b = array_shift($bytes); - $g = gmp_init($b & 0x7f); - $shift = 7; - while (0 != ($b & 0x80)) - { - $b = array_shift($bytes); - $g = gmp_or($g, self::shift_left(($b & 0x7f), $shift)); - $shift += 7; - } - $val = gmp_xor(self::shift_right($g, 1), gmp_neg(gmp_and($g, 1))); - return gmp_strval($val); - } - -} diff --git a/avro-php-1.8.1/lib/avro/io.php b/avro-php-1.8.1/lib/avro/io.php deleted file mode 100644 index 1bd479a..0000000 --- a/avro-php-1.8.1/lib/avro/io.php +++ /dev/null @@ -1,494 +0,0 @@ -not like eof in C or feof in PHP: - * it returns TRUE if the *next* read would be end of file, - * rather than if the *most recent* read read end of file. - * @returns boolean true if at the end of file, and false otherwise - */ - public function is_eof() - { - throw new AvroNotImplementedException('Not implemented'); - } - - /** - * Closes this AvroIO instance. - */ - public function close() - { - throw new AvroNotImplementedException('Not implemented'); - } - -} - -/** - * AvroIO wrapper for string access - * @package Avro - */ -class AvroStringIO extends AvroIO -{ - /** - * @var string - */ - private $string_buffer; - /** - * @var int current position in string - */ - private $current_index; - /** - * @var boolean whether or not the string is closed. - */ - private $is_closed; - - /** - * @param string $str initial value of AvroStringIO buffer. Regardless - * of the initial value, the pointer is set to the - * beginning of the buffer. - * @throws AvroIOException if a non-string value is passed as $str - */ - public function __construct($str = '') - { - $this->is_closed = false; - $this->string_buffer = ''; - $this->current_index = 0; - - if (is_string($str)) - $this->string_buffer .= $str; - else - throw new AvroIOException( - sprintf('constructor argument must be a string: %s', gettype($str))); - } - - /** - * Append bytes to this buffer. - * (Nothing more is needed to support Avro.) - * @param str $arg bytes to write - * @returns int count of bytes written. - * @throws AvroIOException if $args is not a string value. - */ - public function write($arg) - { - $this->check_closed(); - if (is_string($arg) || is_int($arg)) - return $this->append_str($arg); - throw new AvroIOException( - sprintf('write argument must be a string: (%s) %s', - gettype($arg), var_export($arg, true))); - } - - /** - * @returns string bytes read from buffer - * @todo test for fencepost errors wrt updating current_index - */ - public function read($len) - { - $this->check_closed(); - $read=''; - for($i=$this->current_index; $i<($this->current_index+$len); $i++) - $read .= $this->string_buffer[$i]; - if (strlen($read) < $len) - $this->current_index = $this->length(); - else - $this->current_index += $len; - return $read; - } - - /** - * @returns boolean true if successful - * @throws AvroIOException if the seek failed. - */ - public function seek($offset, $whence=self::SEEK_SET) - { - if (!is_int($offset)) - throw new AvroIOException('Seek offset must be an integer.'); - // Prevent seeking before BOF - switch ($whence) - { - case self::SEEK_SET: - if (0 > $offset) - throw new AvroIOException('Cannot seek before beginning of file.'); - $this->current_index = $offset; - break; - case self::SEEK_CUR: - if (0 > $this->current_index + $whence) - throw new AvroIOException('Cannot seek before beginning of file.'); - $this->current_index += $offset; - break; - case self::SEEK_END: - if (0 > $this->length() + $offset) - throw new AvroIOException('Cannot seek before beginning of file.'); - $this->current_index = $this->length() + $offset; - break; - default: - throw new AvroIOException(sprintf('Invalid seek whence %d', $whence)); - } - - return true; - } - - /** - * @returns int - * @see AvroIO::tell() - */ - public function tell() { return $this->current_index; } - - /** - * @returns boolean - * @see AvroIO::is_eof() - */ - public function is_eof() - { - return ($this->current_index >= $this->length()); - } - - /** - * No-op provided for compatibility with AvroIO interface. - * @returns boolean true - */ - public function flush() { return true; } - - /** - * Marks this buffer as closed. - * @returns boolean true - */ - public function close() - { - $this->check_closed(); - $this->is_closed = true; - return true; - } - - /** - * @throws AvroIOException if the buffer is closed. - */ - private function check_closed() - { - if ($this->is_closed()) - throw new AvroIOException('Buffer is closed'); - } - - /** - * Appends bytes to this buffer. - * @param string $str - * @returns integer count of bytes written. - */ - private function append_str($str) - { - $this->check_closed(); - $this->string_buffer .= $str; - $len = strlen($str); - $this->current_index += $len; - return $len; - } - - /** - * Truncates the truncate buffer to 0 bytes and returns the pointer - * to the beginning of the buffer. - * @returns boolean true - */ - public function truncate() - { - $this->check_closed(); - $this->string_buffer = ''; - $this->current_index = 0; - return true; - } - - /** - * @returns int count of bytes in the buffer - * @internal Could probably memoize length for performance, but - * no need do this yet. - */ - public function length() { return strlen($this->string_buffer); } - - /** - * @returns string - */ - public function __toString() { return $this->string_buffer; } - - - /** - * @returns string - * @uses self::__toString() - */ - public function string() { return $this->__toString(); } - - /** - * @returns boolean true if this buffer is closed and false - * otherwise. - */ - public function is_closed() { return $this->is_closed; } -} - -/** - * AvroIO wrapper for PHP file access functions - * @package Avro - */ -class AvroFile extends AvroIO -{ - /** - * @var string fopen read mode value. Used internally. - */ - const FOPEN_READ_MODE = 'rb'; - - /** - * @var string fopen write mode value. Used internally. - */ - const FOPEN_WRITE_MODE = 'wb'; - - /** - * @var string - */ - private $file_path; - - /** - * @var resource file handle for AvroFile instance - */ - private $file_handle; - - public function __construct($file_path, $mode = self::READ_MODE) - { - /** - * XXX: should we check for file existence (in case of reading) - * or anything else about the provided file_path argument? - */ - $this->file_path = $file_path; - switch ($mode) - { - case self::WRITE_MODE: - $this->file_handle = fopen($this->file_path, self::FOPEN_WRITE_MODE); - if (false == $this->file_handle) - throw new AvroIOException('Could not open file for writing'); - break; - case self::READ_MODE: - $this->file_handle = fopen($this->file_path, self::FOPEN_READ_MODE); - if (false == $this->file_handle) - throw new AvroIOException('Could not open file for reading'); - break; - default: - throw new AvroIOException( - sprintf("Only modes '%s' and '%s' allowed. You provided '%s'.", - self::READ_MODE, self::WRITE_MODE, $mode)); - } - } - - /** - * @returns int count of bytes written - * @throws AvroIOException if write failed. - */ - public function write($str) - { - $len = fwrite($this->file_handle, $str); - if (false === $len) - throw new AvroIOException(sprintf('Could not write to file')); - return $len; - } - - /** - * @param int $len count of bytes to read. - * @returns string bytes read - * @throws AvroIOException if length value is negative or if the read failed - */ - public function read($len) - { - if (0 > $len) - throw new AvroIOException( - sprintf("Invalid length value passed to read: %d", $len)); - - if (0 == $len) - return ''; - - $bytes = fread($this->file_handle, $len); - if (false === $bytes) - throw new AvroIOException('Could not read from file'); - return $bytes; - } - - /** - * @returns int current position within the file - * @throws AvroFileExcpetion if tell failed. - */ - public function tell() - { - $position = ftell($this->file_handle); - if (false === $position) - throw new AvroIOException('Could not execute tell on reader'); - return $position; - } - - /** - * @param int $offset - * @param int $whence - * @returns boolean true upon success - * @throws AvroIOException if seek failed. - * @see AvroIO::seek() - */ - public function seek($offset, $whence = SEEK_SET) - { - $res = fseek($this->file_handle, $offset, $whence); - // Note: does not catch seeking beyond end of file - if (-1 === $res) - throw new AvroIOException( - sprintf("Could not execute seek (offset = %d, whence = %d)", - $offset, $whence)); - return true; - } - - /** - * Closes the file. - * @returns boolean true if successful. - * @throws AvroIOException if there was an error closing the file. - */ - public function close() - { - $res = fclose($this->file_handle); - if (false === $res) - throw new AvroIOException('Error closing file.'); - return $res; - } - - /** - * @returns boolean true if the pointer is at the end of the file, - * and false otherwise. - * @see AvroIO::is_eof() as behavior differs from feof() - */ - public function is_eof() - { - $this->read(1); - if (feof($this->file_handle)) - return true; - $this->seek(-1, self::SEEK_CUR); - return false; - } - - /** - * @returns boolean true if the flush was successful. - * @throws AvroIOException if there was an error flushing the file. - */ - public function flush() - { - $res = fflush($this->file_handle); - if (false === $res) - throw new AvroIOException('Could not flush file.'); - return true; - } - -} diff --git a/avro-php-1.8.1/lib/avro/protocol.php b/avro-php-1.8.1/lib/avro/protocol.php deleted file mode 100644 index a558e66..0000000 --- a/avro-php-1.8.1/lib/avro/protocol.php +++ /dev/null @@ -1,86 +0,0 @@ -real_parse(json_decode($json, true)); - return $protocol; - } - - function real_parse($avro) { - $this->protocol = $avro["protocol"]; - $this->namespace = $avro["namespace"]; - $this->schemata = new AvroNamedSchemata(); - $this->name = $avro["protocol"]; - - if (!is_null($avro["types"])) { - $types = AvroSchema::real_parse($avro["types"], $this->namespace, $this->schemata); - } - - if (!is_null($avro["messages"])) { - foreach ($avro["messages"] as $messageName => $messageAvro) { - $message = new AvroProtocolMessage($messageName, $messageAvro, $this); - $this->messages{$messageName} = $message; - } - } - } -} - -class AvroProtocolMessage -{ - /** - * @var AvroRecordSchema $request - */ - - public $request; - - public $response; - - public function __construct($name, $avro, $protocol) - { - $this->name = $name; - $this->request = new AvroRecordSchema(new AvroName($name, null, $protocol->namespace), null, $avro{'request'}, $protocol->schemata, AvroSchema::REQUEST_SCHEMA); - - if (array_key_exists('response', $avro)) { - $this->response = $protocol->schemata->schema_by_name(new AvroName($avro{'response'}, $protocol->namespace, $protocol->namespace)); - if ($this->response == null) - $this->response = new AvroPrimitiveSchema($avro{'response'}); - } - } -} - -class AvroProtocolParseException extends AvroException {}; diff --git a/avro-php-1.8.1/lib/avro/schema.php b/avro-php-1.8.1/lib/avro/schema.php deleted file mode 100644 index df2cb0c..0000000 --- a/avro-php-1.8.1/lib/avro/schema.php +++ /dev/null @@ -1,1457 +0,0 @@ -type) - { - case self::NULL_TYPE: - return is_null($datum); - case self::BOOLEAN_TYPE: - return is_bool($datum); - case self::STRING_TYPE: - case self::BYTES_TYPE: - return is_string($datum); - case self::INT_TYPE: - return (is_int($datum) - && (self::INT_MIN_VALUE <= $datum) - && ($datum <= self::INT_MAX_VALUE)); - case self::LONG_TYPE: - return (is_int($datum) - && (self::LONG_MIN_VALUE <= $datum) - && ($datum <= self::LONG_MAX_VALUE)); - case self::FLOAT_TYPE: - case self::DOUBLE_TYPE: - return (is_float($datum) || is_int($datum)); - case self::ARRAY_SCHEMA: - if (is_array($datum)) - { - foreach ($datum as $d) - if (!self::is_valid_datum($expected_schema->items(), $d)) - return false; - return true; - } - return false; - case self::MAP_SCHEMA: - if (is_array($datum)) - { - foreach ($datum as $k => $v) - if ((!is_string($k) && !is_int($k)) - || !self::is_valid_datum($expected_schema->values(), $v)) - return false; - return true; - } - return false; - case self::UNION_SCHEMA: - foreach ($expected_schema->schemas() as $schema) - if (self::is_valid_datum($schema, $datum)) - return true; - return false; - case self::ENUM_SCHEMA: - return in_array($datum, $expected_schema->symbols()); - case self::FIXED_SCHEMA: - return (is_string($datum) - && (strlen($datum) == $expected_schema->size())); - case self::RECORD_SCHEMA: - case self::ERROR_SCHEMA: - case self::REQUEST_SCHEMA: - if (is_array($datum)) - { - foreach ($expected_schema->fields() as $field) - $value = isset($datum[$field->name()]) ? $datum[$field->name()] : null; - if (!self::is_valid_datum($field->type(), $value)) return false; - return true; - } - return false; - default: - throw new AvroSchemaParseException( - sprintf('%s is not allowed.', $expected_schema)); - } - } - - /** - * @internal Should only be called from within the constructor of - * a class which extends AvroSchema - * @param string $type a schema type name - */ - public function __construct($type) - { - $this->type = $type; - } - - /** - * @param mixed $avro - * @param string $default_namespace namespace of enclosing schema - * @param AvroNamedSchemata &$schemata - * @returns AvroSchema - * @uses AvroSchema::real_parse() - * @throws AvroSchemaParseException - */ - protected static function subparse($avro, $default_namespace, &$schemata=null) - { - try - { - return self::real_parse($avro, $default_namespace, $schemata); - } - catch (AvroSchemaParseException $e) - { - throw $e; - } - catch (Exception $e) - { - throw new AvroSchemaParseException( - sprintf('Sub-schema is not a valid Avro schema. Bad schema: %s', - print_r($avro, true))); - } - - } - - /** - * @returns string schema type name of this schema - */ - public function type() { return $this->type; } - - /** - * @returns mixed - */ - public function to_avro() - { - return array(self::TYPE_ATTR => $this->type); - } - - /** - * @returns string the JSON-encoded representation of this Avro schema. - */ - public function __toString() { return json_encode($this->to_avro()); } - - /** - * @returns mixed value of the attribute with the given attribute name - */ - public function attribute($attribute) { return $this->$attribute(); } - -} - -/** - * Avro schema for basic types such as null, int, long, string. - * @package Avro - */ -class AvroPrimitiveSchema extends AvroSchema -{ - - /** - * @param string $type the primitive schema type name - * @throws AvroSchemaParseException if the given $type is not a - * primitive schema type name - */ - public function __construct($type) - { - if (self::is_primitive_type($type)) - return parent::__construct($type); - throw new AvroSchemaParseException( - sprintf('%s is not a valid primitive type.', $type)); - } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = parent::to_avro(); - // FIXME: Is this if really necessary? When *wouldn't* this be the case? - if (1 == count($avro)) - return $this->type; - return $avro; - } -} - -/** - * Avro array schema, consisting of items of a particular - * Avro schema type. - * @package Avro - */ -class AvroArraySchema extends AvroSchema -{ - /** - * @var AvroName|AvroSchema named schema name or AvroSchema of - * array element - */ - private $items; - - /** - * @var boolean true if the items schema - * FIXME: couldn't we derive this from whether or not $this->items - * is an AvroName or an AvroSchema? - */ - private $is_items_schema_from_schemata; - - /** - * @param string|mixed $items AvroNamedSchema name or object form - * of decoded JSON schema representation. - * @param string $default_namespace namespace of enclosing schema - * @param AvroNamedSchemata &$schemata - */ - public function __construct($items, $default_namespace, &$schemata=null) - { - parent::__construct(AvroSchema::ARRAY_SCHEMA); - - $this->is_items_schema_from_schemata = false; - $items_schema = null; - if (is_string($items) - && $items_schema = $schemata->schema_by_name( - new AvroName($items, null, $default_namespace))) - $this->is_items_schema_from_schemata = true; - else - $items_schema = AvroSchema::subparse($items, $default_namespace, $schemata); - - $this->items = $items_schema; - } - - - /** - * @returns AvroName|AvroSchema named schema name or AvroSchema - * of this array schema's elements. - */ - public function items() { return $this->items; } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = parent::to_avro(); - $avro[AvroSchema::ITEMS_ATTR] = $this->is_items_schema_from_schemata - ? $this->items->qualified_name() : $this->items->to_avro(); - return $avro; - } -} - -/** - * Avro map schema consisting of named values of defined - * Avro Schema types. - * @package Avro - */ -class AvroMapSchema extends AvroSchema -{ - /** - * @var string|AvroSchema named schema name or AvroSchema - * of map schema values. - */ - private $values; - - /** - * @var boolean true if the named schema - * XXX Couldn't we derive this based on whether or not - * $this->values is a string? - */ - private $is_values_schema_from_schemata; - - /** - * @param string|AvroSchema $values - * @param string $default_namespace namespace of enclosing schema - * @param AvroNamedSchemata &$schemata - */ - public function __construct($values, $default_namespace, &$schemata=null) - { - parent::__construct(AvroSchema::MAP_SCHEMA); - - $this->is_values_schema_from_schemata = false; - $values_schema = null; - if (is_string($values) - && $values_schema = $schemata->schema_by_name( - new AvroName($values, null, $default_namespace))) - $this->is_values_schema_from_schemata = true; - else - $values_schema = AvroSchema::subparse($values, $default_namespace, - $schemata); - - $this->values = $values_schema; - } - - /** - * @returns XXX|AvroSchema - */ - public function values() { return $this->values; } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = parent::to_avro(); - $avro[AvroSchema::VALUES_ATTR] = $this->is_values_schema_from_schemata - ? $this->values->qualified_name() : $this->values->to_avro(); - return $avro; - } -} - -/** - * Union of Avro schemas, of which values can be of any of the schema in - * the union. - * @package Avro - */ -class AvroUnionSchema extends AvroSchema -{ - /** - * @var AvroSchema[] list of schemas of this union - */ - private $schemas; - - /** - * @var int[] list of indices of named schemas which - * are defined in $schemata - */ - public $schema_from_schemata_indices; - - /** - * @param AvroSchema[] $schemas list of schemas in the union - * @param string $default_namespace namespace of enclosing schema - * @param AvroNamedSchemata &$schemata - */ - public function __construct($schemas, $default_namespace, &$schemata=null) - { - parent::__construct(AvroSchema::UNION_SCHEMA); - - $this->schema_from_schemata_indices = array(); - $schema_types = array(); - foreach ($schemas as $index => $schema) - { - $is_schema_from_schemata = false; - $new_schema = null; - if (is_string($schema) - && ($new_schema = $schemata->schema_by_name( - new AvroName($schema, null, $default_namespace)))) - $is_schema_from_schemata = true; - else - $new_schema = self::subparse($schema, $default_namespace, $schemata); - - $schema_type = $new_schema->type; - if (self::is_valid_type($schema_type) - && !self::is_named_type($schema_type) - && in_array($schema_type, $schema_types)) - throw new AvroSchemaParseException( - sprintf('"%s" is already in union', $schema_type)); - elseif (AvroSchema::UNION_SCHEMA == $schema_type) - throw new AvroSchemaParseException('Unions cannot contain other unions'); - else - { - $schema_types []= $schema_type; - $this->schemas []= $new_schema; - if ($is_schema_from_schemata) - $this->schema_from_schemata_indices []= $index; - } - } - - } - - /** - * @returns AvroSchema[] - */ - public function schemas() { return $this->schemas; } - - /** - * @returns AvroSchema the particular schema from the union for - * the given (zero-based) index. - * @throws AvroSchemaParseException if the index is invalid for this schema. - */ - public function schema_by_index($index) - { - if (count($this->schemas) > $index) - return $this->schemas[$index]; - - throw new AvroSchemaParseException('Invalid union schema index'); - } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = array(); - - foreach ($this->schemas as $index => $schema) - $avro []= (in_array($index, $this->schema_from_schemata_indices)) - ? $schema->qualified_name() : $schema->to_avro(); - - return $avro; - } -} - -/** - * Parent class of named Avro schema - * @package Avro - * @todo Refactor AvroNamedSchema to use an AvroName instance - * to store name information. - */ -class AvroNamedSchema extends AvroSchema -{ - /** - * @var AvroName $name - */ - private $name; - - /** - * @var string documentation string - */ - private $doc; - - /** - * @param string $type - * @param AvroName $name - * @param string $doc documentation string - * @param AvroNamedSchemata &$schemata - * @throws AvroSchemaParseException - */ - public function __construct($type, $name, $doc=null, &$schemata=null) - { - parent::__construct($type); - $this->name = $name; - - if ($doc && !is_string($doc)) - throw new AvroSchemaParseException('Schema doc attribute must be a string'); - $this->doc = $doc; - - if (!is_null($schemata)) - $schemata = $schemata->clone_with_new_schema($this); - } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = parent::to_avro(); - list($name, $namespace) = AvroName::extract_namespace($this->qualified_name()); - $avro[AvroSchema::NAME_ATTR] = $name; - if ($namespace) - $avro[AvroSchema::NAMESPACE_ATTR] = $namespace; - if (!is_null($this->doc)) - $avro[AvroSchema::DOC_ATTR] = $this->doc; - return $avro; - } - - /** - * @returns string - */ - public function fullname() { return $this->name->fullname(); } - - public function qualified_name() { return $this->name->qualified_name(); } - -} - -/** - * @package Avro - */ -class AvroName -{ - /** - * @var string character used to separate names comprising the fullname - */ - const NAME_SEPARATOR = '.'; - - /** - * @var string regular expression to validate name values - */ - const NAME_REGEXP = '/^[A-Za-z_][A-Za-z0-9_]*$/'; - - /** - * @returns string[] array($name, $namespace) - */ - public static function extract_namespace($name, $namespace=null) - { - $parts = explode(self::NAME_SEPARATOR, $name); - if (count($parts) > 1) - { - $name = array_pop($parts); - $namespace = join(self::NAME_SEPARATOR, $parts); - } - return array($name, $namespace); - } - - /** - * @returns boolean true if the given name is well-formed - * (is a non-null, non-empty string) and false otherwise - */ - public static function is_well_formed_name($name) - { - return (is_string($name) && !empty($name) - && preg_match(self::NAME_REGEXP, $name)); - } - - /** - * @param string $namespace - * @returns boolean true if namespace is composed of valid names - * @throws AvroSchemaParseException if any of the namespace components - * are invalid. - */ - private static function check_namespace_names($namespace) - { - foreach (explode(self::NAME_SEPARATOR, $namespace) as $n) - { - if (empty($n) || (0 == preg_match(self::NAME_REGEXP, $n))) - throw new AvroSchemaParseException(sprintf('Invalid name "%s"', $n)); - } - return true; - } - - /** - * @param string $name - * @param string $namespace - * @returns string - * @throws AvroSchemaParseException if any of the names are not valid. - */ - private static function parse_fullname($name, $namespace) - { - if (!is_string($namespace) || empty($namespace)) - throw new AvroSchemaParseException('Namespace must be a non-empty string.'); - self::check_namespace_names($namespace); - return $namespace . '.' . $name; - } - - /** - * @var string valid names are matched by self::NAME_REGEXP - */ - private $name; - - /** - * @var string - */ - private $namespace; - - /** - * @var string - */ - private $fullname; - - /** - * @var string Name qualified as necessary given its default namespace. - */ - private $qualified_name; - - /** - * @param string $name - * @param string $namespace - * @param string $default_namespace - */ - public function __construct($name, $namespace, $default_namespace) - { - if (!is_string($name) || empty($name)) - throw new AvroSchemaParseException('Name must be a non-empty string.'); - - if (strpos($name, self::NAME_SEPARATOR) - && self::check_namespace_names($name)) - $this->fullname = $name; - elseif (0 == preg_match(self::NAME_REGEXP, $name)) - throw new AvroSchemaParseException(sprintf('Invalid name "%s"', $name)); - elseif (!is_null($namespace)) - $this->fullname = self::parse_fullname($name, $namespace); - elseif (!is_null($default_namespace)) - $this->fullname = self::parse_fullname($name, $default_namespace); - else - $this->fullname = $name; - - list($this->name, $this->namespace) = self::extract_namespace($this->fullname); - $this->qualified_name = (is_null($this->namespace) - || $this->namespace == $default_namespace) - ? $this->name : $this->fullname; - } - - /** - * @returns array array($name, $namespace) - */ - public function name_and_namespace() - { - return array($this->name, $this->namespace); - } - - /** - * @returns string - */ - public function fullname() { return $this->fullname; } - - /** - * @returns string fullname - * @uses $this->fullname() - */ - public function __toString() { return $this->fullname(); } - - /** - * @returns string name qualified for its context - */ - public function qualified_name() { return $this->qualified_name; } - -} - -/** - * Keeps track of AvroNamedSchema which have been observed so far, - * as well as the default namespace. - * - * @package Avro - */ -class AvroNamedSchemata -{ - /** - * @var AvroNamedSchema[] - */ - private $schemata; - - /** - * @param AvroNamedSchemata[] - */ - public function __construct($schemata=array()) - { - $this->schemata = $schemata; - } - - public function list_schemas() { - var_export($this->schemata); - foreach($this->schemata as $sch) - print('Schema '.$sch->__toString()."\n"); - } - - /** - * @param string $fullname - * @returns boolean true if there exists a schema with the given name - * and false otherwise. - */ - public function has_name($fullname) - { - return array_key_exists($fullname, $this->schemata); - } - - /** - * @param string $fullname - * @returns AvroSchema|null the schema which has the given name, - * or null if there is no schema with the given name. - */ - public function schema($fullname) - { - if (isset($this->schemata[$fullname])) - return $this->schemata[$fullname]; - return null; - } - - /** - * @param AvroName $name - * @returns AvroSchema|null - */ - public function schema_by_name($name) - { - return $this->schema($name->fullname()); - } - - /** - * Creates a new AvroNamedSchemata instance of this schemata instance - * with the given $schema appended. - * @param AvroNamedSchema schema to add to this existing schemata - * @returns AvroNamedSchemata - */ - public function clone_with_new_schema($schema) - { - $name = $schema->fullname(); - if (AvroSchema::is_valid_type($name)) - throw new AvroSchemaParseException( - sprintf('Name "%s" is a reserved type name', $name)); - else if ($this->has_name($name)) - throw new AvroSchemaParseException( - sprintf('Name "%s" is already in use', $name)); - $schemata = new AvroNamedSchemata($this->schemata); - $schemata->schemata[$name] = $schema; - return $schemata; - } -} - -/** - * @package Avro - */ -class AvroEnumSchema extends AvroNamedSchema -{ - /** - * @var string[] array of symbols - */ - private $symbols; - - /** - * @param AvroName $name - * @param string $doc - * @param string[] $symbols - * @param AvroNamedSchemata &$schemata - * @throws AvroSchemaParseException - */ - public function __construct($name, $doc, $symbols, &$schemata=null) - { - if (!AvroUtil::is_list($symbols)) - throw new AvroSchemaParseException('Enum Schema symbols are not a list'); - - if (count(array_unique($symbols)) > count($symbols)) - throw new AvroSchemaParseException( - sprintf('Duplicate symbols: %s', $symbols)); - - foreach ($symbols as $symbol) - if (!is_string($symbol) || empty($symbol)) - throw new AvroSchemaParseException( - sprintf('Enum schema symbol must be a string %', - print_r($symbol, true))); - - parent::__construct(AvroSchema::ENUM_SCHEMA, $name, $doc, $schemata); - $this->symbols = $symbols; - } - - /** - * @returns string[] this enum schema's symbols - */ - public function symbols() { return $this->symbols; } - - /** - * @param string $symbol - * @returns boolean true if the given symbol exists in this - * enum schema and false otherwise - */ - public function has_symbol($symbol) - { - return in_array($symbol, $this->symbols); - } - - /** - * @param int $index - * @returns string enum schema symbol with the given (zero-based) index - */ - public function symbol_by_index($index) - { - if (array_key_exists($index, $this->symbols)) - return $this->symbols[$index]; - throw new AvroException(sprintf('Invalid symbol index %d', $index)); - } - - /** - * @param string $symbol - * @returns int the index of the given $symbol in the enum schema - */ - public function symbol_index($symbol) - { - $idx = array_search($symbol, $this->symbols, true); - if (false !== $idx) - return $idx; - throw new AvroException(sprintf("Invalid symbol value '%s'", $symbol)); - } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = parent::to_avro(); - $avro[AvroSchema::SYMBOLS_ATTR] = $this->symbols; - return $avro; - } -} - -/** - * AvroNamedSchema with fixed-length data values - * @package Avro - */ -class AvroFixedSchema extends AvroNamedSchema -{ - - /** - * @var int byte count of this fixed schema data value - */ - private $size; - - /** - * @param AvroName $name - * @param string $doc Set to null, as fixed schemas don't have doc strings - * @param int $size byte count of this fixed schema data value - * @param AvroNamedSchemata &$schemata - */ - public function __construct($name, $doc, $size, &$schemata=null) - { - $doc = null; // Fixed schemas don't have doc strings. - if (!is_integer($size)) - throw new AvroSchemaParseException( - 'Fixed Schema requires a valid integer for "size" attribute'); - parent::__construct(AvroSchema::FIXED_SCHEMA, $name, $doc, $schemata); - return $this->size = $size; - } - - /** - * @returns int byte count of this fixed schema data value - */ - public function size() { return $this->size; } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = parent::to_avro(); - $avro[AvroSchema::SIZE_ATTR] = $this->size; - return $avro; - } -} - -/** - * @package Avro - */ -class AvroRecordSchema extends AvroNamedSchema -{ - /** - * @param mixed $field_data - * @param string $default_namespace namespace of enclosing schema - * @param AvroNamedSchemata &$schemata - * @returns AvroField[] - * @throws AvroSchemaParseException - */ - static function parse_fields($field_data, $default_namespace, &$schemata) - { - $fields = array(); - $field_names = array(); - foreach ($field_data as $index => $field) - { - $name = AvroUtil::array_value($field, AvroField::FIELD_NAME_ATTR); - $type = AvroUtil::array_value($field, AvroSchema::TYPE_ATTR); - $order = AvroUtil::array_value($field, AvroField::ORDER_ATTR); - - $default = null; - $has_default = false; - if (array_key_exists(AvroField::DEFAULT_ATTR, $field)) - { - $default = $field[AvroField::DEFAULT_ATTR]; - $has_default = true; - } - - if (in_array($name, $field_names)) - throw new AvroSchemaParseException( - sprintf("Field name %s is already in use", $name)); - - $is_schema_from_schemata = false; - $field_schema = null; - if (is_string($type) - && $field_schema = $schemata->schema_by_name( - new AvroName($type, null, $default_namespace))) - $is_schema_from_schemata = true; - else - $field_schema = self::subparse($type, $default_namespace, $schemata); - - $new_field = new AvroField($name, $field_schema, $is_schema_from_schemata, - $has_default, $default, $order); - $field_names []= $name; - $fields []= $new_field; - } - return $fields; - } - - /** - * @var AvroSchema[] array of AvroNamedSchema field definitions of - * this AvroRecordSchema - */ - private $fields; - - /** - * @var array map of field names to field objects. - * @internal Not called directly. Memoization of AvroRecordSchema->fields_hash() - */ - private $fields_hash; - - /** - * @param string $name - * @param string $namespace - * @param string $doc - * @param array $fields - * @param AvroNamedSchemata &$schemata - * @param string $schema_type schema type name - * @throws AvroSchemaParseException - */ - public function __construct($name, $doc, $fields, &$schemata=null, - $schema_type=AvroSchema::RECORD_SCHEMA) - { - if (is_null($fields)) - throw new AvroSchemaParseException( - 'Record schema requires a non-empty fields attribute'); - - if (AvroSchema::REQUEST_SCHEMA == $schema_type) - parent::__construct($schema_type, $name); - else - parent::__construct($schema_type, $name, $doc, $schemata); - - list($x, $namespace) = $name->name_and_namespace(); - $this->fields = self::parse_fields($fields, $namespace, $schemata); - } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = parent::to_avro(); - - $fields_avro = array(); - foreach ($this->fields as $field) - $fields_avro [] = $field->to_avro(); - - if (AvroSchema::REQUEST_SCHEMA == $this->type) - return $fields_avro; - - $avro[AvroSchema::FIELDS_ATTR] = $fields_avro; - - return $avro; - } - - /** - * @returns array the schema definitions of the fields of this AvroRecordSchema - */ - public function fields() { return $this->fields; } - - /** - * @returns array a hash table of the fields of this AvroRecordSchema fields - * keyed by each field's name - */ - public function fields_hash() - { - if (is_null($this->fields_hash)) - { - $hash = array(); - foreach ($this->fields as $field) - $hash[$field->name()] = $field; - $this->fields_hash = $hash; - } - return $this->fields_hash; - } -} - -/** - * Field of an {@link AvroRecordSchema} - * @package Avro - */ -class AvroField extends AvroSchema -{ - - /** - * @var string fields name attribute name - */ - const FIELD_NAME_ATTR = 'name'; - - /** - * @var string - */ - const DEFAULT_ATTR = 'default'; - - /** - * @var string - */ - const ORDER_ATTR = 'order'; - - /** - * @var string - */ - const ASC_SORT_ORDER = 'ascending'; - - /** - * @var string - */ - const DESC_SORT_ORDER = 'descending'; - - /** - * @var string - */ - const IGNORE_SORT_ORDER = 'ignore'; - - /** - * @var array list of valid field sort order values - */ - private static $valid_field_sort_orders = array(self::ASC_SORT_ORDER, - self::DESC_SORT_ORDER, - self::IGNORE_SORT_ORDER); - - - /** - * @param string $order - * @returns boolean - */ - private static function is_valid_field_sort_order($order) - { - return in_array($order, self::$valid_field_sort_orders); - } - - /** - * @param string $order - * @throws AvroSchemaParseException if $order is not a valid - * field order value. - */ - private static function check_order_value($order) - { - if (!is_null($order) && !self::is_valid_field_sort_order($order)) - throw new AvroSchemaParseException( - sprintf('Invalid field sort order %s', $order)); - } - - /** - * @var string - */ - private $name; - - /** - * @var boolean whether or no there is a default value - */ - private $has_default; - - /** - * @var string field default value - */ - private $default; - - /** - * @var string sort order of this field - */ - private $order; - - /** - * @var boolean whether or not the AvroNamedSchema of this field is - * defined in the AvroNamedSchemata instance - */ - private $is_type_from_schemata; - - /** - * @param string $type - * @param string $name - * @param AvroSchema $schema - * @param boolean $is_type_from_schemata - * @param string $default - * @param string $order - * @todo Check validity of $default value - * @todo Check validity of $order value - */ - public function __construct($name, $schema, $is_type_from_schemata, - $has_default, $default, $order=null) - { - if (!AvroName::is_well_formed_name($name)) - throw new AvroSchemaParseException('Field requires a "name" attribute'); - - $this->type = $schema; - $this->is_type_from_schemata = $is_type_from_schemata; - $this->name = $name; - $this->has_default = $has_default; - if ($this->has_default) - $this->default = $default; - $this->check_order_value($order); - $this->order = $order; - } - - /** - * @returns mixed - */ - public function to_avro() - { - $avro = array(AvroField::FIELD_NAME_ATTR => $this->name); - - $avro[AvroSchema::TYPE_ATTR] = ($this->is_type_from_schemata) - ? $this->type->qualified_name() : $this->type->to_avro(); - - if (isset($this->default)) - $avro[AvroField::DEFAULT_ATTR] = $this->default; - - if ($this->order) - $avro[AvroField::ORDER_ATTR] = $this->order; - - return $avro; - } - - /** - * @returns string the name of this field - */ - public function name() { return $this->name; } - - /** - * @returns mixed the default value of this field - */ - public function default_value() { return $this->default; } - - /** - * @returns boolean true if the field has a default and false otherwise - */ - public function has_default_value() { return $this->has_default; } -} diff --git a/avro-php-1.8.1/lib/avro/util.php b/avro-php-1.8.1/lib/avro/util.php deleted file mode 100644 index a43613e..0000000 --- a/avro-php-1.8.1/lib/avro/util.php +++ /dev/null @@ -1,67 +0,0 @@ - $v) - { - if ($i !== $k) - return false; - $i++; - } - return true; - } - return false; - } - - /** - * @param array $ary - * @param string $key - * @returns mixed the value of $ary[$key] if it is set, - * and null otherwise. - */ - static function array_value($ary, $key) - { - return isset($ary[$key]) ? $ary[$key] : null; - } -} From afae69159e6c68e574550697ecc64abcdb0b0e75 Mon Sep 17 00:00:00 2001 From: John Berube Date: Tue, 10 Dec 2024 12:41:01 -0500 Subject: [PATCH 32/57] Updates Avro library to use composer. --- .gitignore | 1 + composer.json | 3 +- src/AvroDeserializer.php | 41 ++++++++++++++------------- src/AvroLoader.php | 35 ----------------------- src/BulkModels.php | 3 +- src/Model/ModelTrait/DBReadTrait.php | 4 +-- src/Model/ModelTrait/MessageTrait.php | 29 ++++++++++--------- src/Schema.php | 14 +++++---- src/SchemaClient.php | 5 ++-- 9 files changed, 54 insertions(+), 81 deletions(-) delete mode 100644 src/AvroLoader.php diff --git a/.gitignore b/.gitignore index 5d13a24..65b8a2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ composer.lock vendor .idea +.DS_Store diff --git a/composer.json b/composer.json index 46cc246..ff23102 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "aws/aws-sdk-php": "^3.319.4", "vlucas/phpdotenv": "^5.6.1", "guzzlehttp/guzzle": "^7.9.2", - "aura/di": "4.*" + "aura/di": "4.*", + "nealio82/avro-php": "^0.1.2" }, "require-dev": { }, diff --git a/src/AvroDeserializer.php b/src/AvroDeserializer.php index 238af75..7f3e38e 100644 --- a/src/AvroDeserializer.php +++ b/src/AvroDeserializer.php @@ -1,6 +1,9 @@ getCacheKey()] = $avroIo; } @@ -135,7 +136,7 @@ protected static function addAvroIoToCache(Schema $schema, \AvroStringIO $avroIo /** * @param Schema $schema * - * @return \AvroIODatumReader|null + * @return IODatumReader|null */ protected static function getAvroReader(Schema $schema) { @@ -143,7 +144,7 @@ protected static function getAvroReader(Schema $schema) return $avroReader; } - $avroReader = new \AvroIODatumReader($schema->getAvroSchema()); + $avroReader = new IODatumReader($schema->getAvroSchema()); self::addAvroReaderToCache($schema, $avroReader); @@ -153,7 +154,7 @@ protected static function getAvroReader(Schema $schema) /** * @param Schema $schema * - * @return \AvroIODatumReader|null + * @return IODatumReader|null */ protected static function getCachedAvroReader(Schema $schema) { @@ -166,9 +167,9 @@ protected static function getCachedAvroReader(Schema $schema) /** * @param Schema $schema - * @param \AvroIODatumReader $avroReader + * @param IODatumReader $avroReader */ - protected static function addAvroReaderToCache(Schema $schema, \AvroIODatumReader $avroReader) + protected static function addAvroReaderToCache(Schema $schema, IODatumReader $avroReader) { self::$avroReaderCache[$schema->getCacheKey()] = $avroReader; } @@ -176,7 +177,7 @@ protected static function addAvroReaderToCache(Schema $schema, \AvroIODatumReade /** * @param Schema $schema * - * @return \AvroIOBinaryDecoder|null + * @return IOBinaryDecoder|null */ protected static function getAvroDecoder(Schema $schema) { @@ -184,7 +185,7 @@ protected static function getAvroDecoder(Schema $schema) return $avroDecoder; } - $avroDecoder = new \AvroIOBinaryDecoder(self::getAvroIo($schema)); + $avroDecoder = new IOBinaryDecoder(self::getAvroIo($schema)); self::addAvroDecoderToCache($schema, $avroDecoder); @@ -194,7 +195,7 @@ protected static function getAvroDecoder(Schema $schema) /** * @param Schema $schema * - * @return \AvroIOBinaryDecoder|null + * @return IOBinaryDecoder|null */ protected static function getCachedAvroDecoder(Schema $schema) { @@ -207,9 +208,9 @@ protected static function getCachedAvroDecoder(Schema $schema) /** * @param Schema $schema - * @param \AvroIOBinaryDecoder $avroDecoder + * @param IOBinaryDecoder $avroDecoder */ - protected static function addAvroDecoderToCache(Schema $schema, \AvroIOBinaryDecoder $avroDecoder) + protected static function addAvroDecoderToCache(Schema $schema, IOBinaryDecoder $avroDecoder) { self::$avroDecoderCache[$schema->getCacheKey()] = $avroDecoder; } diff --git a/src/AvroLoader.php b/src/AvroLoader.php deleted file mode 100644 index 1dbf8a1..0000000 --- a/src/AvroLoader.php +++ /dev/null @@ -1,35 +0,0 @@ -getOrderBy())) { /** diff --git a/src/Model/ModelTrait/MessageTrait.php b/src/Model/ModelTrait/MessageTrait.php index 24c0d55..3b32ac4 100644 --- a/src/Model/ModelTrait/MessageTrait.php +++ b/src/Model/ModelTrait/MessageTrait.php @@ -1,13 +1,18 @@ getAvroSchema()); + $writer = new IODatumWriter($this->getAvroSchema()); self::$avroCache[$streamName]['writer'] = $writer; @@ -162,7 +167,7 @@ protected function getAvroWriter() } /** - * @return \AvroIOBinaryEncoder + * @return IOBinaryEncoder */ protected function getAvroEncoder() { @@ -172,7 +177,7 @@ protected function getAvroEncoder() return self::$avroCache[$streamName]['encoder']; } - $encoder = new \AvroIOBinaryEncoder(self::getAvroIo()); + $encoder = new IOBinaryEncoder(self::getAvroIo()); self::$avroCache[$streamName]['encoder'] = $encoder; @@ -184,8 +189,6 @@ protected function getAvroEncoder() */ protected function encodeMessageAsAvro() { - AvroLoader::load(); - self::getAvroWriter()->write( json_decode(json_encode($this), true), self::getAvroEncoder() @@ -199,7 +202,7 @@ protected function encodeMessageAsAvro() } /** - * @throws \AvroIOException + * @throws IOException * @return string */ public function createMessage() @@ -239,7 +242,7 @@ public static function setClient($client) } /** - * @return \AvroSchema + * @return Schema */ public function getAvroSchema() { @@ -252,7 +255,7 @@ public function getAvroSchema() */ $jsonSchema = json_encode($this->getSchema()); - $schema = \AvroSchema::parse($jsonSchema); + $schema = Schema::parse($jsonSchema); self::$schemaCache[$this->getStreamName()] = $schema; diff --git a/src/Schema.php b/src/Schema.php index 5e20e43..e88b3e9 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -1,6 +1,8 @@ setTopic($topic); @@ -80,7 +82,7 @@ public function setOffset($offset) } /** - * @return \AvroSchema + * @return AvroSchema */ public function getAvroSchema() { @@ -88,9 +90,9 @@ public function getAvroSchema() } /** - * @param \AvroSchema $avroSchema + * @param AvroSchema $avroSchema */ - public function setAvroSchema(\AvroSchema $avroSchema) + public function setAvroSchema(AvroSchema $avroSchema) { $this->avroSchema = $avroSchema; } diff --git a/src/SchemaClient.php b/src/SchemaClient.php index 8246b74..7c7f81c 100644 --- a/src/SchemaClient.php +++ b/src/SchemaClient.php @@ -2,6 +2,7 @@ namespace NYPL\Starter; use GuzzleHttp\Client; +use Avro\Schema\Schema as AvroSchema; class SchemaClient { @@ -60,8 +61,6 @@ protected static function getSchemaResponse($schemaName = '') */ public static function getSchema($schemaName = '') { - AvroLoader::load(); - $cacheKey = self::BASE_CACHE_KEY . 'Schema:' . $schemaName; if ($schema = AppCache::get($cacheKey)) { @@ -73,7 +72,7 @@ public static function getSchema($schemaName = '') $schema = new Schema( $schemaName, 0, - \AvroSchema::parse($response['data']['schema']), + AvroSchema::parse($response['data']['schema']), $response['data']['schemaObject'] ); From c88c3a8f41914e108b69db6d95e1d6a220678342 Mon Sep 17 00:00:00 2001 From: John Berube Date: Fri, 20 Dec 2024 17:46:12 -0500 Subject: [PATCH 33/57] Replaces forked Avro PHP library with nealio/avro-php composer dependency. Updates code to use new classes. Applies patch to match the forked changes previously made by Kevin Friedman. --- composer.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ff23102..f6461d9 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,21 @@ }, "autoload": { "psr-4": { - "NYPL\\Starter\\": [ "src/" ] + "NYPL\\Starter\\": [ + "src/" + ] + } + }, + "extra": { + "patches": { + "nealio82/avro-php": { + "Allow integers": "patches/avro-php-allow-integers.patch" + } + } + }, + "config": { + "allow-plugins": { + "cweagans/composer-patches": true } } } From e962af8a5df6c24699f7cf23bd09fd225c7f3812 Mon Sep 17 00:00:00 2001 From: John Berube Date: Fri, 20 Dec 2024 17:46:37 -0500 Subject: [PATCH 34/57] Adds composer patch. --- patches/avro-php-allow-integers.patch | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 patches/avro-php-allow-integers.patch diff --git a/patches/avro-php-allow-integers.patch b/patches/avro-php-allow-integers.patch new file mode 100644 index 0000000..e7b3527 --- /dev/null +++ b/patches/avro-php-allow-integers.patch @@ -0,0 +1,63 @@ +diff --git a/src/Avro/Datum/IODatumWriter.php b/src/Avro/Datum/IODatumWriter.php +index c868909..c9ab2c3 100644 +--- a/src/Avro/Datum/IODatumWriter.php ++++ b/src/Avro/Datum/IODatumWriter.php +@@ -153,9 +153,12 @@ class IODatumWriter + + private function write_record(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { +- foreach ($writers_schema->fields() as $field) +- $this->write_data($field->type(), $datum[$field->name()], $encoder); ++ foreach ($writers_schema->fields() as $field) { ++ /* Patched to supply a default value with a field isn't set. */ ++ $value = isset($datum[$field->name()]) ? $datum[$field->name()] : $field->default_value(); ++ $this->write_data($field->type(), $value, $encoder); ++ } + } + + /**#@-*/ +-} +\ No newline at end of file ++} +diff --git a/src/Avro/IO/StringIO.php b/src/Avro/IO/StringIO.php +index 0158f7d..8716b60 100644 +--- a/src/Avro/IO/StringIO.php ++++ b/src/Avro/IO/StringIO.php +@@ -53,7 +53,8 @@ class StringIO extends IO + public function write($arg) + { + $this->check_closed(); +- if (is_string($arg)) ++ /* Patched to allow integers. */ ++ if (is_string($arg) || is_int($arg)) + return $this->append_str($arg); + throw new IOException( + sprintf('write argument must be a string: (%s) %s', +@@ -221,4 +222,4 @@ class StringIO extends IO + { + return $this->is_closed; + } +-} +\ No newline at end of file ++} +diff --git a/src/Avro/Schema/Schema.php b/src/Avro/Schema/Schema.php +index b384f6b..1e253fa 100644 +--- a/src/Avro/Schema/Schema.php ++++ b/src/Avro/Schema/Schema.php +@@ -369,7 +369,8 @@ class Schema + if (is_array($datum)) + { + foreach ($datum as $k => $v) +- if (!is_string($k) ++ /* Patched to allow integers. */ ++ if ((!is_string($k) && !is_int($k)) + || !self::is_valid_datum($expected_schema->values(), $v)) + return false; + return true; +@@ -462,4 +463,4 @@ class Schema + */ + public function attribute($attribute) { return $this->$attribute(); } + +-} +\ No newline at end of file ++} From 27eaee9e1baebf3513efa3eb5c5d3b8057871db1 Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 10:29:16 -0500 Subject: [PATCH 35/57] Adds composer.lock --- .gitignore | 1 - composer.lock | 2201 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2201 insertions(+), 1 deletion(-) create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 65b8a2f..6a2315d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -composer.lock vendor .idea .DS_Store diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..8c50274 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2201 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "38020e16bf9053004f536520e682efa4", + "packages": [ + { + "name": "aura/di", + "version": "4.2.1", + "source": { + "type": "git", + "url": "https://github.com/auraphp/Aura.Di.git", + "reference": "faf49669dae6b422f298803f25ef12997906f2e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auraphp/Aura.Di/zipball/faf49669dae6b422f298803f25ef12997906f2e9", + "reference": "faf49669dae6b422f298803f25ef12997906f2e9", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "psr/container": "^1.1.1 || ^2.0.2" + }, + "provide": { + "psr/container-implementation": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "producer/producer": "^2.3", + "roave/security-advisories": "dev-master" + }, + "type": "library", + "autoload": { + "psr-4": { + "Aura\\Di\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aura.Di Contributors", + "homepage": "https://github.com/auraphp/Aura.Di/contributors" + } + ], + "description": "A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.", + "homepage": "https://github.com/auraphp/Aura.Di", + "keywords": [ + "container", + "dependency injection", + "dependency injection container", + "di", + "di container" + ], + "support": { + "issues": "https://github.com/auraphp/Aura.Di/issues", + "source": "https://github.com/auraphp/Aura.Di/tree/4.2.1" + }, + "time": "2022-01-04T21:37:03+00:00" + }, + { + "name": "aws/aws-crt-php", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/awslabs/aws-crt-php.git", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/d71d9906c7bb63a28295447ba12e74723bd3730e", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35||^5.6.3||^9.5", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality." + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "AWS SDK Common Runtime Team", + "email": "aws-sdk-common-runtime@amazon.com" + } + ], + "description": "AWS Common Runtime for PHP", + "homepage": "https://github.com/awslabs/aws-crt-php", + "keywords": [ + "amazon", + "aws", + "crt", + "sdk" + ], + "support": { + "issues": "https://github.com/awslabs/aws-crt-php/issues", + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.7" + }, + "time": "2024-10-18T22:15:13+00:00" + }, + { + "name": "aws/aws-sdk-php", + "version": "3.336.2", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/954bfdfc048840ca34afe2a2e1cbcff6681989c4", + "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4", + "shasum": "" + }, + "require": { + "aws/aws-crt-php": "^1.2.3", + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", + "guzzlehttp/promises": "^1.4.0 || ^2.0", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", + "mtdowling/jmespath.php": "^2.6", + "php": ">=7.2.5", + "psr/http-message": "^1.0 || ^2.0" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "composer/composer": "^1.10.22", + "dms/phpunit-arraysubset-asserts": "^0.4.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "nette/neon": "^2.3", + "paragonie/random_compat": ">= 2", + "phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", + "sebastian/comparator": "^1.2.3 || ^4.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Aws\\": "src/" + }, + "exclude-from-classmap": [ + "src/data/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "support": { + "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", + "issues": "https://github.com/aws/aws-sdk-php/issues", + "source": "https://github.com/aws/aws-sdk-php/tree/3.336.2" + }, + "time": "2024-12-20T19:05:10+00:00" + }, + { + "name": "danielstjules/stringy", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/danielstjules/Stringy.git", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Create.php" + ], + "psr-4": { + "Stringy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel St. Jules", + "email": "danielst.jules@gmail.com", + "homepage": "http://www.danielstjules.com" + } + ], + "description": "A string manipulation library with multibyte support", + "homepage": "https://github.com/danielstjules/Stringy", + "keywords": [ + "UTF", + "helpers", + "manipulation", + "methods", + "multibyte", + "string", + "utf-8", + "utility", + "utils" + ], + "support": { + "issues": "https://github.com/danielstjules/Stringy/issues", + "source": "https://github.com/danielstjules/Stringy" + }, + "time": "2017-06-12T01:10:27+00:00" + }, + { + "name": "faapz/pdo", + "version": "v2.2.1", + "source": { + "type": "git", + "url": "https://github.com/FaaPz/PDO.git", + "reference": "d1de9b42b3d11188886055d93a2d68cc2765fa10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FaaPz/PDO/zipball/d1de9b42b3d11188886055d93a2d68cc2765fa10", + "reference": "d1de9b42b3d11188886055d93a2d68cc2765fa10", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "php": ">=7.2.0" + }, + "require-dev": { + "phan/phan": "^5", + "phpunit/phpunit": "^8", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "FaaPz\\PDO\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabian de Laender", + "email": "fabian@faapz.productions", + "homepage": "https://faapz.productions", + "role": "Owner" + }, + { + "name": "Alexander Barker", + "email": "alex@1stleg.com", + "homepage": "https://github.com/kwhat/", + "role": "Collaborator" + } + ], + "description": "Just another PDO database library", + "homepage": "https://github.com/FaaPz/PDO", + "keywords": [ + "database", + "pdo", + "sql" + ], + "support": { + "docs": "https://github.com/FaaPz/PDO/blob/master/docs/README.md", + "issues": "https://github.com/FaaPz/PDO/issues", + "source": "https://github.com/FaaPz/PDO/tree/v2.2.1" + }, + "time": "2022-08-11T01:08:08+00:00" + }, + { + "name": "graham-campbell/result-type", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:45:45+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.9.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2024-07-24T11:22:20+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2024-10-17T10:06:22+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.7.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2024-07-18T11:15:46+00:00" + }, + { + "name": "monolog/monolog", + "version": "3.8.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/aef6ee73a77a66e404dd6540934a9ef1b3c855b4", + "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2 || ^2.0", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "php-console/php-console": "^3.1.8", + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^10.5.17 || ^11.0.7", + "predis/predis": "^1.1 || ^2", + "rollbar/rollbar": "^4.0", + "ruflin/elastica": "^7 || ^8", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/3.8.1" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2024-12-05T17:15:07+00:00" + }, + { + "name": "mtdowling/jmespath.php", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "composer/xdebug-handler": "^3.0.3", + "phpunit/phpunit": "^8.5.33" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "files": [ + "src/JmesPath.php" + ], + "psr-4": { + "JmesPath\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "support": { + "issues": "https://github.com/jmespath/jmespath.php/issues", + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" + }, + "time": "2024-09-04T18:46:31+00:00" + }, + { + "name": "nealio82/avro-php", + "version": "0.1.2", + "source": { + "type": "git", + "url": "https://github.com/nealio82/avro-php.git", + "reference": "678ef0c69cc63fb060559a64b6d1b8e61111a7c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nealio82/avro-php/zipball/678ef0c69cc63fb060559a64b6d1b8e61111a7c0", + "reference": "678ef0c69cc63fb060559a64b6d1b8e61111a7c0", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Avro\\": "src/Avro" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Implementation of Apache's Avro PHP library with Composer support, PSR-4 autoloading, namespaces, and type hinted method parameters", + "support": { + "issues": "https://github.com/nealio82/avro-php/issues", + "source": "https://github.com/nealio82/avro-php/tree/fix-namespaces-and-documentation" + }, + "time": "2017-01-30T13:18:10+00:00" + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "FastRoute\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "support": { + "issues": "https://github.com/nikic/FastRoute/issues", + "source": "https://github.com/nikic/FastRoute/tree/master" + }, + "time": "2018-02-13T20:26:39+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.9.3", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:41:07+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, + { + "name": "psr/http-server-handler", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side request handler", + "keywords": [ + "handler", + "http", + "http-interop", + "psr", + "psr-15", + "psr-7", + "request", + "response", + "server" + ], + "support": { + "source": "https://github.com/php-fig/http-server-handler/tree/1.0.2" + }, + "time": "2023-04-10T20:06:20+00:00" + }, + { + "name": "psr/http-server-middleware", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0", + "psr/http-server-handler": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "http", + "http-interop", + "middleware", + "psr", + "psr-15", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-server-middleware/issues", + "source": "https://github.com/php-fig/http-server-middleware/tree/1.0.2" + }, + "time": "2023-04-11T06:14:47+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "slim/slim", + "version": "4.14.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "5943393b88716eb9e82c4161caa956af63423913" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/5943393b88716eb9e82c4161caa956af63423913", + "reference": "5943393b88716eb9e82c4161caa956af63423913", + "shasum": "" + }, + "require": { + "ext-json": "*", + "nikic/fast-route": "^1.3", + "php": "^7.4 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "psr/http-factory": "^1.1", + "psr/http-message": "^1.1 || ^2.0", + "psr/http-server-handler": "^1.0", + "psr/http-server-middleware": "^1.0", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "adriansuter/php-autoload-override": "^1.4", + "ext-simplexml": "*", + "guzzlehttp/psr7": "^2.6", + "httpsoft/http-message": "^1.1", + "httpsoft/http-server-request": "^1.1", + "laminas/laminas-diactoros": "^2.17 || ^3", + "nyholm/psr7": "^1.8", + "nyholm/psr7-server": "^1.1", + "phpspec/prophecy": "^1.19", + "phpspec/prophecy-phpunit": "^2.1", + "phpstan/phpstan": "^1.11", + "phpunit/phpunit": "^9.6", + "slim/http": "^1.3", + "slim/psr7": "^1.6", + "squizlabs/php_codesniffer": "^3.10", + "vimeo/psalm": "^5.24" + }, + "suggest": { + "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", + "ext-xml": "Needed to support XML format in BodyParsingMiddleware", + "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", + "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://www.slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "support": { + "docs": "https://www.slimframework.com/docs/v4/", + "forum": "https://discourse.slimframework.com/", + "irc": "irc://irc.freenode.net:6667/slimphp", + "issues": "https://github.com/slimphp/Slim/issues", + "rss": "https://www.slimframework.com/blog/feed.rss", + "slack": "https://slimphp.slack.com/", + "source": "https://github.com/slimphp/Slim", + "wiki": "https://github.com/slimphp/Slim/wiki" + }, + "funding": [ + { + "url": "https://opencollective.com/slimphp", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slim/slim", + "type": "tidelift" + } + ], + "time": "2024-06-13T08:54:48+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/finder", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/6de263e5868b9a137602dd1e33e4d48bfae99c49", + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "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": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-23T06:56:12+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/yaml", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "099581e99f557e9f16b43c5916c26380b54abb22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/099581e99f557e9f16b43c5916c26380b54abb22", + "reference": "099581e99f557e9f16b43c5916c26380b54abb22", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "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": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-23T06:56:12+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.6.1", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.3", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3", + "symfony/polyfill-ctype": "^1.24", + "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php80": "^1.24" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-filter": "*", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:52:34+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "4.11.1", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7df10e8ec47db07c031db317a25bef962b4e5de1", + "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.2", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "symfony/deprecation-contracts": "^2 || ^3", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.7 || ^2.0", + "friendsofphp/php-cs-fixer": "^2.17 || 3.62.0", + "phpstan/phpstan": "^1.6", + "phpunit/phpunit": ">=8", + "vimeo/psalm": "^4.23" + }, + "suggest": { + "doctrine/annotations": "^1.7 || ^2.0" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "https://bfanger.nl" + }, + { + "name": "Martin Rademacher", + "email": "mano@radebatz.net", + "homepage": "https://radebatz.net" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "support": { + "issues": "https://github.com/zircote/swagger-php/issues", + "source": "https://github.com/zircote/swagger-php/tree/4.11.1" + }, + "time": "2024-10-15T19:20:02+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.3.0" +} From 6890aad22c99932fd369cb6acb8b03eecbc71eba Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 11:19:55 -0500 Subject: [PATCH 36/57] Adds composer patches dependency. --- composer.json | 5 +- composer.lock | 2201 ------------------------------------------------- 2 files changed, 2 insertions(+), 2204 deletions(-) delete mode 100644 composer.lock diff --git a/composer.json b/composer.json index f6461d9..fe13ada 100644 --- a/composer.json +++ b/composer.json @@ -17,9 +17,8 @@ "vlucas/phpdotenv": "^5.6.1", "guzzlehttp/guzzle": "^7.9.2", "aura/di": "4.*", - "nealio82/avro-php": "^0.1.2" - }, - "require-dev": { + "nealio82/avro-php": "^0.1.2", + "cweagans/composer-patches": "^1.7" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 8c50274..0000000 --- a/composer.lock +++ /dev/null @@ -1,2201 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "38020e16bf9053004f536520e682efa4", - "packages": [ - { - "name": "aura/di", - "version": "4.2.1", - "source": { - "type": "git", - "url": "https://github.com/auraphp/Aura.Di.git", - "reference": "faf49669dae6b422f298803f25ef12997906f2e9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/auraphp/Aura.Di/zipball/faf49669dae6b422f298803f25ef12997906f2e9", - "reference": "faf49669dae6b422f298803f25ef12997906f2e9", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0", - "psr/container": "^1.1.1 || ^2.0.2" - }, - "provide": { - "psr/container-implementation": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5", - "producer/producer": "^2.3", - "roave/security-advisories": "dev-master" - }, - "type": "library", - "autoload": { - "psr-4": { - "Aura\\Di\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Aura.Di Contributors", - "homepage": "https://github.com/auraphp/Aura.Di/contributors" - } - ], - "description": "A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.", - "homepage": "https://github.com/auraphp/Aura.Di", - "keywords": [ - "container", - "dependency injection", - "dependency injection container", - "di", - "di container" - ], - "support": { - "issues": "https://github.com/auraphp/Aura.Di/issues", - "source": "https://github.com/auraphp/Aura.Di/tree/4.2.1" - }, - "time": "2022-01-04T21:37:03+00:00" - }, - { - "name": "aws/aws-crt-php", - "version": "v1.2.7", - "source": { - "type": "git", - "url": "https://github.com/awslabs/aws-crt-php.git", - "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/d71d9906c7bb63a28295447ba12e74723bd3730e", - "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35||^5.6.3||^9.5", - "yoast/phpunit-polyfills": "^1.0" - }, - "suggest": { - "ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality." - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "AWS SDK Common Runtime Team", - "email": "aws-sdk-common-runtime@amazon.com" - } - ], - "description": "AWS Common Runtime for PHP", - "homepage": "https://github.com/awslabs/aws-crt-php", - "keywords": [ - "amazon", - "aws", - "crt", - "sdk" - ], - "support": { - "issues": "https://github.com/awslabs/aws-crt-php/issues", - "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.7" - }, - "time": "2024-10-18T22:15:13+00:00" - }, - { - "name": "aws/aws-sdk-php", - "version": "3.336.2", - "source": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/954bfdfc048840ca34afe2a2e1cbcff6681989c4", - "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4", - "shasum": "" - }, - "require": { - "aws/aws-crt-php": "^1.2.3", - "ext-json": "*", - "ext-pcre": "*", - "ext-simplexml": "*", - "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", - "guzzlehttp/promises": "^1.4.0 || ^2.0", - "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", - "mtdowling/jmespath.php": "^2.6", - "php": ">=7.2.5", - "psr/http-message": "^1.0 || ^2.0" - }, - "require-dev": { - "andrewsville/php-token-reflection": "^1.4", - "aws/aws-php-sns-message-validator": "~1.0", - "behat/behat": "~3.0", - "composer/composer": "^1.10.22", - "dms/phpunit-arraysubset-asserts": "^0.4.0", - "doctrine/cache": "~1.4", - "ext-dom": "*", - "ext-openssl": "*", - "ext-pcntl": "*", - "ext-sockets": "*", - "nette/neon": "^2.3", - "paragonie/random_compat": ">= 2", - "phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", - "sebastian/comparator": "^1.2.3 || ^4.0", - "yoast/phpunit-polyfills": "^1.0" - }, - "suggest": { - "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", - "doctrine/cache": "To use the DoctrineCacheAdapter", - "ext-curl": "To send requests using cURL", - "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", - "ext-sockets": "To use client-side monitoring" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Aws\\": "src/" - }, - "exclude-from-classmap": [ - "src/data/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Amazon Web Services", - "homepage": "http://aws.amazon.com" - } - ], - "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", - "homepage": "http://aws.amazon.com/sdkforphp", - "keywords": [ - "amazon", - "aws", - "cloud", - "dynamodb", - "ec2", - "glacier", - "s3", - "sdk" - ], - "support": { - "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", - "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.336.2" - }, - "time": "2024-12-20T19:05:10+00:00" - }, - { - "name": "danielstjules/stringy", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/danielstjules/Stringy.git", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Create.php" - ], - "psr-4": { - "Stringy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel St. Jules", - "email": "danielst.jules@gmail.com", - "homepage": "http://www.danielstjules.com" - } - ], - "description": "A string manipulation library with multibyte support", - "homepage": "https://github.com/danielstjules/Stringy", - "keywords": [ - "UTF", - "helpers", - "manipulation", - "methods", - "multibyte", - "string", - "utf-8", - "utility", - "utils" - ], - "support": { - "issues": "https://github.com/danielstjules/Stringy/issues", - "source": "https://github.com/danielstjules/Stringy" - }, - "time": "2017-06-12T01:10:27+00:00" - }, - { - "name": "faapz/pdo", - "version": "v2.2.1", - "source": { - "type": "git", - "url": "https://github.com/FaaPz/PDO.git", - "reference": "d1de9b42b3d11188886055d93a2d68cc2765fa10" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FaaPz/PDO/zipball/d1de9b42b3d11188886055d93a2d68cc2765fa10", - "reference": "d1de9b42b3d11188886055d93a2d68cc2765fa10", - "shasum": "" - }, - "require": { - "ext-pdo": "*", - "php": ">=7.2.0" - }, - "require-dev": { - "phan/phan": "^5", - "phpunit/phpunit": "^8", - "squizlabs/php_codesniffer": "3.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "FaaPz\\PDO\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabian de Laender", - "email": "fabian@faapz.productions", - "homepage": "https://faapz.productions", - "role": "Owner" - }, - { - "name": "Alexander Barker", - "email": "alex@1stleg.com", - "homepage": "https://github.com/kwhat/", - "role": "Collaborator" - } - ], - "description": "Just another PDO database library", - "homepage": "https://github.com/FaaPz/PDO", - "keywords": [ - "database", - "pdo", - "sql" - ], - "support": { - "docs": "https://github.com/FaaPz/PDO/blob/master/docs/README.md", - "issues": "https://github.com/FaaPz/PDO/issues", - "source": "https://github.com/FaaPz/PDO/tree/v2.2.1" - }, - "time": "2022-08-11T01:08:08+00:00" - }, - { - "name": "graham-campbell/result-type", - "version": "v1.1.3", - "source": { - "type": "git", - "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", - "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.3" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" - }, - "type": "library", - "autoload": { - "psr-4": { - "GrahamCampbell\\ResultType\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "An Implementation Of The Result Type", - "keywords": [ - "Graham Campbell", - "GrahamCampbell", - "Result Type", - "Result-Type", - "result" - ], - "support": { - "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", - "type": "tidelift" - } - ], - "time": "2024-07-20T21:45:45+00:00" - }, - { - "name": "guzzlehttp/guzzle", - "version": "7.9.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.3", - "guzzlehttp/psr7": "^2.7.0", - "php": "^7.2.5 || ^8.0", - "psr/http-client": "^1.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "provide": { - "psr/http-client-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "ext-curl": "*", - "guzzle/client-integration-tests": "3.0.2", - "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.39 || ^9.6.20", - "psr/log": "^1.1 || ^2.0 || ^3.0" - }, - "suggest": { - "ext-curl": "Required for CURL handler support", - "ext-intl": "Required for Internationalized Domain Name (IDN) support", - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "psr-18", - "psr-7", - "rest", - "web service" - ], - "support": { - "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.2" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", - "type": "tidelift" - } - ], - "time": "2024-07-24T11:22:20+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "support": { - "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", - "type": "tidelift" - } - ], - "time": "2024-10-17T10:06:22+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "2.7.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.1 || ^2.0", - "ralouphie/getallheaders": "^3.0" - }, - "provide": { - "psr/http-factory-implementation": "1.0", - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "support": { - "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", - "type": "tidelift" - } - ], - "time": "2024-07-18T11:15:46+00:00" - }, - { - "name": "monolog/monolog", - "version": "3.8.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/aef6ee73a77a66e404dd6540934a9ef1b3c855b4", - "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/log": "^2.0 || ^3.0" - }, - "provide": { - "psr/log-implementation": "3.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^3.0", - "doctrine/couchdb": "~1.0@dev", - "elasticsearch/elasticsearch": "^7 || ^8", - "ext-json": "*", - "graylog2/gelf-php": "^1.4.2 || ^2.0", - "guzzlehttp/guzzle": "^7.4.5", - "guzzlehttp/psr7": "^2.2", - "mongodb/mongodb": "^1.8", - "php-amqplib/php-amqplib": "~2.4 || ^3", - "php-console/php-console": "^3.1.8", - "phpstan/phpstan": "^2", - "phpstan/phpstan-deprecation-rules": "^2", - "phpstan/phpstan-strict-rules": "^2", - "phpunit/phpunit": "^10.5.17 || ^11.0.7", - "predis/predis": "^1.1 || ^2", - "rollbar/rollbar": "^4.0", - "ruflin/elastica": "^7 || ^8", - "symfony/mailer": "^5.4 || ^6", - "symfony/mime": "^5.4 || ^6" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", - "ext-mbstring": "Allow to work properly with unicode symbols", - "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", - "ext-openssl": "Required to send log messages using SSL", - "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "https://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "support": { - "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.8.1" - }, - "funding": [ - { - "url": "https://github.com/Seldaek", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", - "type": "tidelift" - } - ], - "time": "2024-12-05T17:15:07+00:00" - }, - { - "name": "mtdowling/jmespath.php", - "version": "2.8.0", - "source": { - "type": "git", - "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", - "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "symfony/polyfill-mbstring": "^1.17" - }, - "require-dev": { - "composer/xdebug-handler": "^3.0.3", - "phpunit/phpunit": "^8.5.33" - }, - "bin": [ - "bin/jp.php" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "files": [ - "src/JmesPath.php" - ], - "psr-4": { - "JmesPath\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Declaratively specify how to extract elements from a JSON document", - "keywords": [ - "json", - "jsonpath" - ], - "support": { - "issues": "https://github.com/jmespath/jmespath.php/issues", - "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" - }, - "time": "2024-09-04T18:46:31+00:00" - }, - { - "name": "nealio82/avro-php", - "version": "0.1.2", - "source": { - "type": "git", - "url": "https://github.com/nealio82/avro-php.git", - "reference": "678ef0c69cc63fb060559a64b6d1b8e61111a7c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nealio82/avro-php/zipball/678ef0c69cc63fb060559a64b6d1b8e61111a7c0", - "reference": "678ef0c69cc63fb060559a64b6d1b8e61111a7c0", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Avro\\": "src/Avro" - } - }, - "notification-url": "https://packagist.org/downloads/", - "description": "Implementation of Apache's Avro PHP library with Composer support, PSR-4 autoloading, namespaces, and type hinted method parameters", - "support": { - "issues": "https://github.com/nealio82/avro-php/issues", - "source": "https://github.com/nealio82/avro-php/tree/fix-namespaces-and-documentation" - }, - "time": "2017-01-30T13:18:10+00:00" - }, - { - "name": "nikic/fast-route", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/nikic/FastRoute.git", - "reference": "181d480e08d9476e61381e04a71b34dc0432e812" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", - "reference": "181d480e08d9476e61381e04a71b34dc0432e812", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|~5.7" - }, - "type": "library", - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "FastRoute\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov", - "email": "nikic@php.net" - } - ], - "description": "Fast request router for PHP", - "keywords": [ - "router", - "routing" - ], - "support": { - "issues": "https://github.com/nikic/FastRoute/issues", - "source": "https://github.com/nikic/FastRoute/tree/master" - }, - "time": "2018-02-13T20:26:39+00:00" - }, - { - "name": "phpoption/phpoption", - "version": "1.9.3", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", - "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2024-07-20T21:41:07+00:00" - }, - { - "name": "psr/container", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "shasum": "" - }, - "require": { - "php": ">=7.4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" - }, - "time": "2021-11-05T16:47:00+00:00" - }, - { - "name": "psr/http-client", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-client.git", - "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", - "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP clients", - "homepage": "https://github.com/php-fig/http-client", - "keywords": [ - "http", - "http-client", - "psr", - "psr-18" - ], - "support": { - "source": "https://github.com/php-fig/http-client" - }, - "time": "2023-09-23T14:17:50+00:00" - }, - { - "name": "psr/http-factory", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-factory.git", - "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", - "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "psr/http-message": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", - "keywords": [ - "factory", - "http", - "message", - "psr", - "psr-17", - "psr-7", - "request", - "response" - ], - "support": { - "source": "https://github.com/php-fig/http-factory" - }, - "time": "2024-04-15T12:06:14+00:00" - }, - { - "name": "psr/http-message", - "version": "2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", - "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "support": { - "source": "https://github.com/php-fig/http-message/tree/2.0" - }, - "time": "2023-04-04T09:54:51+00:00" - }, - { - "name": "psr/http-server-handler", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-server-handler.git", - "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", - "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "psr/http-message": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Server\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP server-side request handler", - "keywords": [ - "handler", - "http", - "http-interop", - "psr", - "psr-15", - "psr-7", - "request", - "response", - "server" - ], - "support": { - "source": "https://github.com/php-fig/http-server-handler/tree/1.0.2" - }, - "time": "2023-04-10T20:06:20+00:00" - }, - { - "name": "psr/http-server-middleware", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-server-middleware.git", - "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", - "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "psr/http-message": "^1.0 || ^2.0", - "psr/http-server-handler": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Server\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP server-side middleware", - "keywords": [ - "http", - "http-interop", - "middleware", - "psr", - "psr-15", - "psr-7", - "request", - "response" - ], - "support": { - "issues": "https://github.com/php-fig/http-server-middleware/issues", - "source": "https://github.com/php-fig/http-server-middleware/tree/1.0.2" - }, - "time": "2023-04-11T06:14:47+00:00" - }, - { - "name": "psr/log", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/3.0.2" - }, - "time": "2024-09-11T13:17:53+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" - }, - "time": "2019-03-08T08:55:37+00:00" - }, - { - "name": "slim/slim", - "version": "4.14.0", - "source": { - "type": "git", - "url": "https://github.com/slimphp/Slim.git", - "reference": "5943393b88716eb9e82c4161caa956af63423913" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/5943393b88716eb9e82c4161caa956af63423913", - "reference": "5943393b88716eb9e82c4161caa956af63423913", - "shasum": "" - }, - "require": { - "ext-json": "*", - "nikic/fast-route": "^1.3", - "php": "^7.4 || ^8.0", - "psr/container": "^1.0 || ^2.0", - "psr/http-factory": "^1.1", - "psr/http-message": "^1.1 || ^2.0", - "psr/http-server-handler": "^1.0", - "psr/http-server-middleware": "^1.0", - "psr/log": "^1.1 || ^2.0 || ^3.0" - }, - "require-dev": { - "adriansuter/php-autoload-override": "^1.4", - "ext-simplexml": "*", - "guzzlehttp/psr7": "^2.6", - "httpsoft/http-message": "^1.1", - "httpsoft/http-server-request": "^1.1", - "laminas/laminas-diactoros": "^2.17 || ^3", - "nyholm/psr7": "^1.8", - "nyholm/psr7-server": "^1.1", - "phpspec/prophecy": "^1.19", - "phpspec/prophecy-phpunit": "^2.1", - "phpstan/phpstan": "^1.11", - "phpunit/phpunit": "^9.6", - "slim/http": "^1.3", - "slim/psr7": "^1.6", - "squizlabs/php_codesniffer": "^3.10", - "vimeo/psalm": "^5.24" - }, - "suggest": { - "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", - "ext-xml": "Needed to support XML format in BodyParsingMiddleware", - "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", - "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." - }, - "type": "library", - "autoload": { - "psr-4": { - "Slim\\": "Slim" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Josh Lockhart", - "email": "hello@joshlockhart.com", - "homepage": "https://joshlockhart.com" - }, - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://silentworks.co.uk" - }, - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, - { - "name": "Pierre Berube", - "email": "pierre@lgse.com", - "homepage": "http://www.lgse.com" - }, - { - "name": "Gabriel Manricks", - "email": "gmanricks@me.com", - "homepage": "http://gabrielmanricks.com" - } - ], - "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", - "homepage": "https://www.slimframework.com", - "keywords": [ - "api", - "framework", - "micro", - "router" - ], - "support": { - "docs": "https://www.slimframework.com/docs/v4/", - "forum": "https://discourse.slimframework.com/", - "irc": "irc://irc.freenode.net:6667/slimphp", - "issues": "https://github.com/slimphp/Slim/issues", - "rss": "https://www.slimframework.com/blog/feed.rss", - "slack": "https://slimphp.slack.com/", - "source": "https://github.com/slimphp/Slim", - "wiki": "https://github.com/slimphp/Slim/wiki" - }, - "funding": [ - { - "url": "https://opencollective.com/slimphp", - "type": "open_collective" - }, - { - "url": "https://tidelift.com/funding/github/packagist/slim/slim", - "type": "tidelift" - } - ], - "time": "2024-06-13T08:54:48+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.5.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-25T14:20:29+00:00" - }, - { - "name": "symfony/finder", - "version": "v7.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/6de263e5868b9a137602dd1e33e4d48bfae99c49", - "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "symfony/filesystem": "^6.4|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "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": "Finds files and directories via an intuitive fluent interface", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/finder/tree/v7.2.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-10-23T06:56:12+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "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" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/yaml", - "version": "v7.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "099581e99f557e9f16b43c5916c26380b54abb22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/099581e99f557e9f16b43c5916c26380b54abb22", - "reference": "099581e99f557e9f16b43c5916c26380b54abb22", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "symfony/console": "<6.4" - }, - "require-dev": { - "symfony/console": "^6.4|^7.0" - }, - "bin": [ - "Resources/bin/yaml-lint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "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": "Loads and dumps YAML files", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v7.2.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-10-23T06:56:12+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v5.6.1", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", - "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.3", - "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.3", - "symfony/polyfill-ctype": "^1.24", - "symfony/polyfill-mbstring": "^1.24", - "symfony/polyfill-php80": "^1.24" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "ext-filter": "*", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator." - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "support": { - "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", - "type": "tidelift" - } - ], - "time": "2024-07-20T21:52:34+00:00" - }, - { - "name": "zircote/swagger-php", - "version": "4.11.1", - "source": { - "type": "git", - "url": "https://github.com/zircote/swagger-php.git", - "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7df10e8ec47db07c031db317a25bef962b4e5de1", - "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=7.2", - "psr/log": "^1.1 || ^2.0 || ^3.0", - "symfony/deprecation-contracts": "^2 || ^3", - "symfony/finder": ">=2.2", - "symfony/yaml": ">=3.3" - }, - "require-dev": { - "composer/package-versions-deprecated": "^1.11", - "doctrine/annotations": "^1.7 || ^2.0", - "friendsofphp/php-cs-fixer": "^2.17 || 3.62.0", - "phpstan/phpstan": "^1.6", - "phpunit/phpunit": ">=8", - "vimeo/psalm": "^4.23" - }, - "suggest": { - "doctrine/annotations": "^1.7 || ^2.0" - }, - "bin": [ - "bin/openapi" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "OpenApi\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Robert Allen", - "email": "zircote@gmail.com" - }, - { - "name": "Bob Fanger", - "email": "bfanger@gmail.com", - "homepage": "https://bfanger.nl" - }, - { - "name": "Martin Rademacher", - "email": "mano@radebatz.net", - "homepage": "https://radebatz.net" - } - ], - "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", - "homepage": "https://github.com/zircote/swagger-php/", - "keywords": [ - "api", - "json", - "rest", - "service discovery" - ], - "support": { - "issues": "https://github.com/zircote/swagger-php/issues", - "source": "https://github.com/zircote/swagger-php/tree/4.11.1" - }, - "time": "2024-10-15T19:20:02+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" -} From 165b1bedebf4ca15a40f12b7be1053cc9ba3bb85 Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 11:41:24 -0500 Subject: [PATCH 37/57] Adds avro php fork to repo since patches aren't going to be applied for composer subdepencies. --- composer.json | 16 +- composer.lock | 2173 +++++++++++++++++ patches/avro-php-allow-integers.patch | 63 - src/Avro/Avro.php | 151 ++ src/Avro/DataIO/DataIO.php | 170 ++ src/Avro/DataIO/DataIOReader.php | 198 ++ src/Avro/DataIO/DataIOWriter.php | 196 ++ src/Avro/Datum/IOBinaryDecoder.php | 246 ++ src/Avro/Datum/IOBinaryEncoder.php | 160 ++ src/Avro/Datum/IODatumReader.php | 422 ++++ src/Avro/Datum/IODatumWriter.php | 161 ++ src/Avro/Debug/Debug.php | 175 ++ src/Avro/Exception/DataIoException.php | 8 + src/Avro/Exception/Exception.php | 8 + src/Avro/Exception/IOException.php | 11 + src/Avro/Exception/IOSchemaMatchException.php | 24 + src/Avro/Exception/IOTypeException.php | 23 + .../Exception/NotImplementedException.php | 8 + src/Avro/Exception/ProtocolParseException.php | 8 + src/Avro/Exception/SchemaParseException.php | 11 + src/Avro/GMP/GMP.php | 202 ++ src/Avro/IO/File.php | 160 ++ src/Avro/IO/IO.php | 116 + src/Avro/IO/StringIO.php | 224 ++ src/Avro/Protocol/Protocol.php | 47 + src/Avro/Protocol/ProtocolMessage.php | 30 + src/Avro/Schema/ArraySchema.php | 67 + src/Avro/Schema/EnumSchema.php | 95 + src/Avro/Schema/Field.php | 167 ++ src/Avro/Schema/FixedSchema.php | 53 + src/Avro/Schema/MapSchema.php | 66 + src/Avro/Schema/Name.php | 158 ++ src/Avro/Schema/NamedSchema.php | 73 + src/Avro/Schema/NamedSchemata.php | 86 + src/Avro/Schema/PrimitiveSchema.php | 38 + src/Avro/Schema/RecordSchema.php | 138 ++ src/Avro/Schema/Schema.php | 465 ++++ src/Avro/Schema/UnionSchema.php | 100 + src/Avro/Util/Util.php | 46 + 39 files changed, 6485 insertions(+), 78 deletions(-) create mode 100644 composer.lock delete mode 100644 patches/avro-php-allow-integers.patch create mode 100644 src/Avro/Avro.php create mode 100644 src/Avro/DataIO/DataIO.php create mode 100644 src/Avro/DataIO/DataIOReader.php create mode 100644 src/Avro/DataIO/DataIOWriter.php create mode 100644 src/Avro/Datum/IOBinaryDecoder.php create mode 100644 src/Avro/Datum/IOBinaryEncoder.php create mode 100644 src/Avro/Datum/IODatumReader.php create mode 100644 src/Avro/Datum/IODatumWriter.php create mode 100644 src/Avro/Debug/Debug.php create mode 100644 src/Avro/Exception/DataIoException.php create mode 100644 src/Avro/Exception/Exception.php create mode 100644 src/Avro/Exception/IOException.php create mode 100644 src/Avro/Exception/IOSchemaMatchException.php create mode 100644 src/Avro/Exception/IOTypeException.php create mode 100644 src/Avro/Exception/NotImplementedException.php create mode 100644 src/Avro/Exception/ProtocolParseException.php create mode 100644 src/Avro/Exception/SchemaParseException.php create mode 100644 src/Avro/GMP/GMP.php create mode 100644 src/Avro/IO/File.php create mode 100644 src/Avro/IO/IO.php create mode 100644 src/Avro/IO/StringIO.php create mode 100644 src/Avro/Protocol/Protocol.php create mode 100644 src/Avro/Protocol/ProtocolMessage.php create mode 100644 src/Avro/Schema/ArraySchema.php create mode 100644 src/Avro/Schema/EnumSchema.php create mode 100644 src/Avro/Schema/Field.php create mode 100644 src/Avro/Schema/FixedSchema.php create mode 100644 src/Avro/Schema/MapSchema.php create mode 100644 src/Avro/Schema/Name.php create mode 100644 src/Avro/Schema/NamedSchema.php create mode 100644 src/Avro/Schema/NamedSchemata.php create mode 100644 src/Avro/Schema/PrimitiveSchema.php create mode 100644 src/Avro/Schema/RecordSchema.php create mode 100644 src/Avro/Schema/Schema.php create mode 100644 src/Avro/Schema/UnionSchema.php create mode 100644 src/Avro/Util/Util.php diff --git a/composer.json b/composer.json index fe13ada..ca193f3 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,7 @@ "aws/aws-sdk-php": "^3.319.4", "vlucas/phpdotenv": "^5.6.1", "guzzlehttp/guzzle": "^7.9.2", - "aura/di": "4.*", - "nealio82/avro-php": "^0.1.2", - "cweagans/composer-patches": "^1.7" + "aura/di": "4.*" }, "autoload": { "psr-4": { @@ -26,17 +24,5 @@ "src/" ] } - }, - "extra": { - "patches": { - "nealio82/avro-php": { - "Allow integers": "patches/avro-php-allow-integers.patch" - } - } - }, - "config": { - "allow-plugins": { - "cweagans/composer-patches": true - } } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..2323402 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2173 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "07c15a35d1388f718a76e40ce00763b3", + "packages": [ + { + "name": "aura/di", + "version": "4.2.1", + "source": { + "type": "git", + "url": "https://github.com/auraphp/Aura.Di.git", + "reference": "faf49669dae6b422f298803f25ef12997906f2e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auraphp/Aura.Di/zipball/faf49669dae6b422f298803f25ef12997906f2e9", + "reference": "faf49669dae6b422f298803f25ef12997906f2e9", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "psr/container": "^1.1.1 || ^2.0.2" + }, + "provide": { + "psr/container-implementation": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "producer/producer": "^2.3", + "roave/security-advisories": "dev-master" + }, + "type": "library", + "autoload": { + "psr-4": { + "Aura\\Di\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aura.Di Contributors", + "homepage": "https://github.com/auraphp/Aura.Di/contributors" + } + ], + "description": "A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.", + "homepage": "https://github.com/auraphp/Aura.Di", + "keywords": [ + "container", + "dependency injection", + "dependency injection container", + "di", + "di container" + ], + "support": { + "issues": "https://github.com/auraphp/Aura.Di/issues", + "source": "https://github.com/auraphp/Aura.Di/tree/4.2.1" + }, + "time": "2022-01-04T21:37:03+00:00" + }, + { + "name": "aws/aws-crt-php", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/awslabs/aws-crt-php.git", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/d71d9906c7bb63a28295447ba12e74723bd3730e", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35||^5.6.3||^9.5", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality." + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "AWS SDK Common Runtime Team", + "email": "aws-sdk-common-runtime@amazon.com" + } + ], + "description": "AWS Common Runtime for PHP", + "homepage": "https://github.com/awslabs/aws-crt-php", + "keywords": [ + "amazon", + "aws", + "crt", + "sdk" + ], + "support": { + "issues": "https://github.com/awslabs/aws-crt-php/issues", + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.7" + }, + "time": "2024-10-18T22:15:13+00:00" + }, + { + "name": "aws/aws-sdk-php", + "version": "3.336.2", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/954bfdfc048840ca34afe2a2e1cbcff6681989c4", + "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4", + "shasum": "" + }, + "require": { + "aws/aws-crt-php": "^1.2.3", + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", + "guzzlehttp/promises": "^1.4.0 || ^2.0", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", + "mtdowling/jmespath.php": "^2.6", + "php": ">=7.2.5", + "psr/http-message": "^1.0 || ^2.0" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "composer/composer": "^1.10.22", + "dms/phpunit-arraysubset-asserts": "^0.4.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "nette/neon": "^2.3", + "paragonie/random_compat": ">= 2", + "phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", + "sebastian/comparator": "^1.2.3 || ^4.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Aws\\": "src/" + }, + "exclude-from-classmap": [ + "src/data/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "support": { + "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", + "issues": "https://github.com/aws/aws-sdk-php/issues", + "source": "https://github.com/aws/aws-sdk-php/tree/3.336.2" + }, + "time": "2024-12-20T19:05:10+00:00" + }, + { + "name": "danielstjules/stringy", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/danielstjules/Stringy.git", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Create.php" + ], + "psr-4": { + "Stringy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel St. Jules", + "email": "danielst.jules@gmail.com", + "homepage": "http://www.danielstjules.com" + } + ], + "description": "A string manipulation library with multibyte support", + "homepage": "https://github.com/danielstjules/Stringy", + "keywords": [ + "UTF", + "helpers", + "manipulation", + "methods", + "multibyte", + "string", + "utf-8", + "utility", + "utils" + ], + "support": { + "issues": "https://github.com/danielstjules/Stringy/issues", + "source": "https://github.com/danielstjules/Stringy" + }, + "time": "2017-06-12T01:10:27+00:00" + }, + { + "name": "faapz/pdo", + "version": "v2.2.1", + "source": { + "type": "git", + "url": "https://github.com/FaaPz/PDO.git", + "reference": "d1de9b42b3d11188886055d93a2d68cc2765fa10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FaaPz/PDO/zipball/d1de9b42b3d11188886055d93a2d68cc2765fa10", + "reference": "d1de9b42b3d11188886055d93a2d68cc2765fa10", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "php": ">=7.2.0" + }, + "require-dev": { + "phan/phan": "^5", + "phpunit/phpunit": "^8", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "FaaPz\\PDO\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabian de Laender", + "email": "fabian@faapz.productions", + "homepage": "https://faapz.productions", + "role": "Owner" + }, + { + "name": "Alexander Barker", + "email": "alex@1stleg.com", + "homepage": "https://github.com/kwhat/", + "role": "Collaborator" + } + ], + "description": "Just another PDO database library", + "homepage": "https://github.com/FaaPz/PDO", + "keywords": [ + "database", + "pdo", + "sql" + ], + "support": { + "docs": "https://github.com/FaaPz/PDO/blob/master/docs/README.md", + "issues": "https://github.com/FaaPz/PDO/issues", + "source": "https://github.com/FaaPz/PDO/tree/v2.2.1" + }, + "time": "2022-08-11T01:08:08+00:00" + }, + { + "name": "graham-campbell/result-type", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:45:45+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.9.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2024-07-24T11:22:20+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2024-10-17T10:06:22+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.7.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2024-07-18T11:15:46+00:00" + }, + { + "name": "monolog/monolog", + "version": "3.8.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/aef6ee73a77a66e404dd6540934a9ef1b3c855b4", + "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2 || ^2.0", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "php-console/php-console": "^3.1.8", + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^10.5.17 || ^11.0.7", + "predis/predis": "^1.1 || ^2", + "rollbar/rollbar": "^4.0", + "ruflin/elastica": "^7 || ^8", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/3.8.1" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2024-12-05T17:15:07+00:00" + }, + { + "name": "mtdowling/jmespath.php", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "composer/xdebug-handler": "^3.0.3", + "phpunit/phpunit": "^8.5.33" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "files": [ + "src/JmesPath.php" + ], + "psr-4": { + "JmesPath\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "support": { + "issues": "https://github.com/jmespath/jmespath.php/issues", + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" + }, + "time": "2024-09-04T18:46:31+00:00" + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "FastRoute\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "support": { + "issues": "https://github.com/nikic/FastRoute/issues", + "source": "https://github.com/nikic/FastRoute/tree/master" + }, + "time": "2018-02-13T20:26:39+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.9.3", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:41:07+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, + { + "name": "psr/http-server-handler", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side request handler", + "keywords": [ + "handler", + "http", + "http-interop", + "psr", + "psr-15", + "psr-7", + "request", + "response", + "server" + ], + "support": { + "source": "https://github.com/php-fig/http-server-handler/tree/1.0.2" + }, + "time": "2023-04-10T20:06:20+00:00" + }, + { + "name": "psr/http-server-middleware", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0", + "psr/http-server-handler": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "http", + "http-interop", + "middleware", + "psr", + "psr-15", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-server-middleware/issues", + "source": "https://github.com/php-fig/http-server-middleware/tree/1.0.2" + }, + "time": "2023-04-11T06:14:47+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "slim/slim", + "version": "4.14.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "5943393b88716eb9e82c4161caa956af63423913" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/5943393b88716eb9e82c4161caa956af63423913", + "reference": "5943393b88716eb9e82c4161caa956af63423913", + "shasum": "" + }, + "require": { + "ext-json": "*", + "nikic/fast-route": "^1.3", + "php": "^7.4 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "psr/http-factory": "^1.1", + "psr/http-message": "^1.1 || ^2.0", + "psr/http-server-handler": "^1.0", + "psr/http-server-middleware": "^1.0", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "adriansuter/php-autoload-override": "^1.4", + "ext-simplexml": "*", + "guzzlehttp/psr7": "^2.6", + "httpsoft/http-message": "^1.1", + "httpsoft/http-server-request": "^1.1", + "laminas/laminas-diactoros": "^2.17 || ^3", + "nyholm/psr7": "^1.8", + "nyholm/psr7-server": "^1.1", + "phpspec/prophecy": "^1.19", + "phpspec/prophecy-phpunit": "^2.1", + "phpstan/phpstan": "^1.11", + "phpunit/phpunit": "^9.6", + "slim/http": "^1.3", + "slim/psr7": "^1.6", + "squizlabs/php_codesniffer": "^3.10", + "vimeo/psalm": "^5.24" + }, + "suggest": { + "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", + "ext-xml": "Needed to support XML format in BodyParsingMiddleware", + "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", + "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://www.slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "support": { + "docs": "https://www.slimframework.com/docs/v4/", + "forum": "https://discourse.slimframework.com/", + "irc": "irc://irc.freenode.net:6667/slimphp", + "issues": "https://github.com/slimphp/Slim/issues", + "rss": "https://www.slimframework.com/blog/feed.rss", + "slack": "https://slimphp.slack.com/", + "source": "https://github.com/slimphp/Slim", + "wiki": "https://github.com/slimphp/Slim/wiki" + }, + "funding": [ + { + "url": "https://opencollective.com/slimphp", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slim/slim", + "type": "tidelift" + } + ], + "time": "2024-06-13T08:54:48+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/finder", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/6de263e5868b9a137602dd1e33e4d48bfae99c49", + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "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": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-23T06:56:12+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/yaml", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "099581e99f557e9f16b43c5916c26380b54abb22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/099581e99f557e9f16b43c5916c26380b54abb22", + "reference": "099581e99f557e9f16b43c5916c26380b54abb22", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "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": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-23T06:56:12+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.6.1", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.3", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3", + "symfony/polyfill-ctype": "^1.24", + "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php80": "^1.24" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-filter": "*", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:52:34+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "4.11.1", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7df10e8ec47db07c031db317a25bef962b4e5de1", + "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.2", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "symfony/deprecation-contracts": "^2 || ^3", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.7 || ^2.0", + "friendsofphp/php-cs-fixer": "^2.17 || 3.62.0", + "phpstan/phpstan": "^1.6", + "phpunit/phpunit": ">=8", + "vimeo/psalm": "^4.23" + }, + "suggest": { + "doctrine/annotations": "^1.7 || ^2.0" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "https://bfanger.nl" + }, + { + "name": "Martin Rademacher", + "email": "mano@radebatz.net", + "homepage": "https://radebatz.net" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "support": { + "issues": "https://github.com/zircote/swagger-php/issues", + "source": "https://github.com/zircote/swagger-php/tree/4.11.1" + }, + "time": "2024-10-15T19:20:02+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.3.0" +} diff --git a/patches/avro-php-allow-integers.patch b/patches/avro-php-allow-integers.patch deleted file mode 100644 index e7b3527..0000000 --- a/patches/avro-php-allow-integers.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/src/Avro/Datum/IODatumWriter.php b/src/Avro/Datum/IODatumWriter.php -index c868909..c9ab2c3 100644 ---- a/src/Avro/Datum/IODatumWriter.php -+++ b/src/Avro/Datum/IODatumWriter.php -@@ -153,9 +153,12 @@ class IODatumWriter - - private function write_record(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) - { -- foreach ($writers_schema->fields() as $field) -- $this->write_data($field->type(), $datum[$field->name()], $encoder); -+ foreach ($writers_schema->fields() as $field) { -+ /* Patched to supply a default value with a field isn't set. */ -+ $value = isset($datum[$field->name()]) ? $datum[$field->name()] : $field->default_value(); -+ $this->write_data($field->type(), $value, $encoder); -+ } - } - - /**#@-*/ --} -\ No newline at end of file -+} -diff --git a/src/Avro/IO/StringIO.php b/src/Avro/IO/StringIO.php -index 0158f7d..8716b60 100644 ---- a/src/Avro/IO/StringIO.php -+++ b/src/Avro/IO/StringIO.php -@@ -53,7 +53,8 @@ class StringIO extends IO - public function write($arg) - { - $this->check_closed(); -- if (is_string($arg)) -+ /* Patched to allow integers. */ -+ if (is_string($arg) || is_int($arg)) - return $this->append_str($arg); - throw new IOException( - sprintf('write argument must be a string: (%s) %s', -@@ -221,4 +222,4 @@ class StringIO extends IO - { - return $this->is_closed; - } --} -\ No newline at end of file -+} -diff --git a/src/Avro/Schema/Schema.php b/src/Avro/Schema/Schema.php -index b384f6b..1e253fa 100644 ---- a/src/Avro/Schema/Schema.php -+++ b/src/Avro/Schema/Schema.php -@@ -369,7 +369,8 @@ class Schema - if (is_array($datum)) - { - foreach ($datum as $k => $v) -- if (!is_string($k) -+ /* Patched to allow integers. */ -+ if ((!is_string($k) && !is_int($k)) - || !self::is_valid_datum($expected_schema->values(), $v)) - return false; - return true; -@@ -462,4 +463,4 @@ class Schema - */ - public function attribute($attribute) { return $this->$attribute(); } - --} -\ No newline at end of file -+} diff --git a/src/Avro/Avro.php b/src/Avro/Avro.php new file mode 100644 index 0000000..bf3a522 --- /dev/null +++ b/src/Avro/Avro.php @@ -0,0 +1,151 @@ +io = $io; + $this->decoder = new IOBinaryDecoder($this->io); + $this->datum_reader = $datum_reader; + $this->read_header(); + + $codec = Util::array_value($this->metadata, + DataIO::METADATA_CODEC_ATTR); + if ($codec && !DataIO::is_valid_codec($codec)) { + throw new DataIoException(sprintf('Uknown codec: %s', $codec)); + } + + $this->block_count = 0; + // FIXME: Seems unsanitary to set writers_schema here. + // Can't constructor take it as an argument? + $this->datum_reader->set_writers_schema( + Schema::parse($this->metadata[DataIO::METADATA_SCHEMA_ATTR])); + } + + /** + * Reads header of object container + * @throws DataIoException if the file is not an Avro data file. + */ + private function read_header() + { + $this->seek(0, IO::SEEK_SET); + + $magic = $this->read(DataIO::magic_size()); + + if (strlen($magic) < DataIO::magic_size()) + throw new DataIoException( + 'Not an Avro data file: shorter than the Avro magic block'); + + if (DataIO::magic() != $magic) { + + throw new DataIoException( + sprintf('Not an Avro data file: %s does not match %s', + $magic, DataIO::magic())); + } + + $this->metadata = $this->datum_reader->read_data(DataIO::metadata_schema(), + DataIO::metadata_schema(), + $this->decoder); + $this->sync_marker = $this->read(DataIO::SYNC_SIZE); + } + + /** + * @internal Would be nice to implement data() as an iterator, I think + * @returns \Generator + */ + public function data() + { + while (true) { + if (0 == $this->block_count) { + if ($this->is_eof()) { + break; + } + + if ($this->skip_sync()) { + if ($this->is_eof()) { + break; + } + } + + $this->read_block_header(); + } + $data = $this->datum_reader->read($this->decoder); + $this->block_count -= 1; + yield $data; + } + } + + /** + * Closes this writer (and its IO object.) + * @uses IO::close() + */ + public function close() + { + return $this->io->close(); + } + + /** + * @uses IO::seek() + */ + private function seek($offset, $whence) + { + return $this->io->seek($offset, $whence); + } + + public function getSyncMarker() + { + return $this->sync_marker; + } + + public function getMetaDataFor($key) + { + return $this->metadata[$key]; + } + + /** + * @uses IO::read() + */ + private function read($len) + { + return $this->io->read($len); + } + + /** + * @uses IO::is_eof() + */ + private function is_eof() + { + return $this->io->is_eof(); + } + + private function skip_sync() + { + $proposed_sync_marker = $this->read(DataIO::SYNC_SIZE); + if ($proposed_sync_marker != $this->sync_marker) { + $this->seek(-DataIO::SYNC_SIZE, IO::SEEK_CUR); + return false; + } + return true; + } + + /** + * Reads the block header (which includes the count of items in the block + * and the length in bytes of the block) + * @returns int length in bytes of the block. + */ + private function read_block_header() + { + $this->block_count = $this->decoder->read_long(); + return $this->decoder->read_long(); + } + +} \ No newline at end of file diff --git a/src/Avro/DataIO/DataIOWriter.php b/src/Avro/DataIO/DataIOWriter.php new file mode 100644 index 0000000..d10ced5 --- /dev/null +++ b/src/Avro/DataIO/DataIOWriter.php @@ -0,0 +1,196 @@ +io = $io; + $this->encoder = new IOBinaryEncoder($this->io); + $this->datum_writer = $datum_writer; + $this->buffer = new StringIO(); + $this->buffer_encoder = new IOBinaryEncoder($this->buffer); + $this->block_count = 0; + $this->metadata = array(); + + if ($writers_schema) { + $this->sync_marker = self::generate_sync_marker(); + $this->metadata[DataIO::METADATA_CODEC_ATTR] = DataIO::NULL_CODEC; + $this->metadata[DataIO::METADATA_SCHEMA_ATTR] = strval($writers_schema); + $this->write_header(); + } else { + $dataIOReader = new DataIOReader($this->io, new IODatumReader()); + $this->sync_marker = $dataIOReader->getSyncMarker(); + $this->metadata[DataIO::METADATA_CODEC_ATTR] = $dataIOReader->getMetaDataFor(DataIO::METADATA_CODEC_ATTR); + + $schema_from_file = $dataIOReader->getMetaDataFor(DataIO::METADATA_SCHEMA_ATTR); + $this->metadata[DataIO::METADATA_SCHEMA_ATTR] = $schema_from_file; + $this->datum_writer = new IODatumWriter(Schema::parse($schema_from_file)); + $this->seek(0, SEEK_END); + } + } + + /** + * @param mixed $datum + */ + public function append($datum) + { + $this->datum_writer->write($datum, $this->buffer_encoder); + $this->block_count++; + + if ($this->buffer->length() >= DataIO::SYNC_INTERVAL) + $this->write_block(); + } + + /** + * Flushes buffer to IO object container and closes it. + * @return mixed value of $io->close() + * @see IO::close() + */ + public function close() + { + $this->flush(); + return $this->io->close(); + } + + /** + * Flushes buffer to IO object container. + * @returns mixed value of $io->flush() + * @see IO::flush() + */ + private function flush() + { + $this->write_block(); + return $this->io->flush(); + } + + /** + * Writes a block of data to the IO object container. + * @throws DataIOException if the codec provided by the encoder + * is not supported + * @internal Should the codec check happen in the constructor? + * Why wait until we're writing data? + */ + private function write_block() + { + if ($this->block_count > 0) { + $this->encoder->write_long($this->block_count); + $to_write = strval($this->buffer); + $this->encoder->write_long(strlen($to_write)); + + if (DataIO::is_valid_codec( + $this->metadata[DataIO::METADATA_CODEC_ATTR]) + ) + $this->write($to_write); + else + throw new DataIOException( + sprintf('codec %s is not supported', + $this->metadata[DataIO::METADATA_CODEC_ATTR])); + + $this->write($this->sync_marker); + $this->buffer->truncate(); + $this->block_count = 0; + } + } + + /** + * Writes the header of the IO object container + */ + private function write_header() + { + $this->write(DataIO::magic()); + $this->datum_writer->write_data(DataIO::metadata_schema(), + $this->metadata, $this->encoder); + $this->write($this->sync_marker); + } + + /** + * @param string $bytes + * @uses IO::write() + */ + private function write($bytes) + { + return $this->io->write($bytes); + } + + /** + * @param int $offset + * @param int $whence + * @uses IO::seek() + */ + private function seek($offset, $whence) + { + return $this->io->seek($offset, $whence); + } +} \ No newline at end of file diff --git a/src/Avro/Datum/IOBinaryDecoder.php b/src/Avro/Datum/IOBinaryDecoder.php new file mode 100644 index 0000000..3dd78dc --- /dev/null +++ b/src/Avro/Datum/IOBinaryDecoder.php @@ -0,0 +1,246 @@ +> 1) ^ -($n & 1)); + } + + /** + * Performs decoding of the binary string to a float value. + * + * XXX: This is not endian-aware! See comments in + * {@link IOBinaryEncoder::float_to_int_bits()} for details. + * + * @param string $bits + * @returns float + */ + static public function int_bits_to_float($bits) + { + $float = unpack('f', $bits); + return (float)$float[1]; + } + + /** + * Performs decoding of the binary string to a double value. + * + * XXX: This is not endian-aware! See comments in + * {@link IOBinaryEncoder::float_to_int_bits()} for details. + * + * @param string $bits + * @returns float + */ + static public function long_bits_to_double($bits) + { + $double = unpack('d', $bits); + return (double)$double[1]; + } + + /** + * @var IO + */ + private $io; + + /** + * @param IO $io object from which to read. + */ + public function __construct(IO $io) + { + Avro::check_platform(); + $this->io = $io; + } + + /** + * @returns string the next byte from $this->io. + * @throws Exception if the next byte cannot be read. + */ + private function next_byte() + { + return $this->read(1); + } + + /** + * @returns null + */ + public function read_null() + { + return null; + } + + /** + * @returns boolean + */ + public function read_boolean() + { + return (boolean)(1 == ord($this->next_byte())); + } + + /** + * @returns int + */ + public function read_int() + { + return (int)$this->read_long(); + } + + /** + * @returns long + */ + public function read_long() + { + $byte = ord($this->next_byte()); + $bytes = array($byte); + + while (0 != ($byte & 0x80)) { + $byte = ord($this->next_byte()); + $bytes [] = $byte; + } + + if (Avro::uses_gmp()) { + return GMP::decode_long_from_array($bytes); + } + + return self::decode_long_from_array($bytes); + } + + /** + * @returns float + */ + public function read_float() + { + return self::int_bits_to_float($this->read(4)); + } + + /** + * @returns double + */ + public function read_double() + { + return self::long_bits_to_double($this->read(8)); + } + + /** + * A string is encoded as a long followed by that many bytes + * of UTF-8 encoded character data. + * @returns string + */ + public function read_string() + { + return $this->read_bytes(); + } + + /** + * @returns string + */ + public function read_bytes() + { + return $this->read($this->read_long()); + } + + /** + * @param int $len count of bytes to read + * @returns string + */ + public function read($len) + { + return $this->io->read($len); + } + + public function skip_null() + { + return null; + } + + public function skip_boolean() + { + return $this->skip(1); + } + + public function skip_int() + { + return $this->skip_long(); + } + + public function skip_long() + { + $b = $this->next_byte(); + while (0 != ($b & 0x80)) + $b = $this->next_byte(); + } + + public function skip_float() + { + return $this->skip(4); + } + + public function skip_double() + { + return $this->skip(8); + } + + public function skip_bytes() + { + return $this->skip($this->read_long()); + } + + public function skip_string() + { + return $this->skip_bytes(); + } + + /** + * @param int $len count of bytes to skip + * @uses IO::seek() + */ + public function skip($len) + { + $this->seek($len, IO::SEEK_CUR); + } + + /** + * @returns int position of pointer in IO instance + * @uses IO::tell() + */ + private function tell() + { + return $this->io->tell(); + } + + /** + * @param int $offset + * @param int $whence + * @returns boolean true upon success + * @uses IO::seek() + */ + private function seek($offset, $whence) + { + return $this->io->seek($offset, $whence); + } +} \ No newline at end of file diff --git a/src/Avro/Datum/IOBinaryEncoder.php b/src/Avro/Datum/IOBinaryEncoder.php new file mode 100644 index 0000000..c45f2d5 --- /dev/null +++ b/src/Avro/Datum/IOBinaryEncoder.php @@ -0,0 +1,160 @@ +not endian-aware! The {@link Avro::check_platform()} + * called in {@link IOBinaryEncoder::__construct()} should ensure the + * library is only used on little-endian platforms, which ensure the little-endian + * encoding required by the Avro spec. + * + * @param float $float + * @returns string bytes + * @see Avro::check_platform() + */ + static function float_to_int_bits($float) + { + return pack('f', (float)$float); + } + + /** + * Performs encoding of the given double value to a binary string + * + * XXX: This is not endian-aware! See comments in + * {@link IOBinaryEncoder::float_to_int_bits()} for details. + * + * @param double $double + * @returns string bytes + */ + static function double_to_long_bits($double) + { + return pack('d', (double)$double); + } + + /** + * @param int|string $n + * @returns string long $n encoded as bytes + * @internal This relies on 64-bit PHP. + */ + static public function encode_long($n) + { + $n = (int)$n; + $n = ($n << 1) ^ ($n >> 63); + $str = ''; + while (0 != ($n & ~0x7F)) { + $str .= chr(($n & 0x7F) | 0x80); + $n >>= 7; + } + $str .= chr($n); + return $str; + } + + /** + * @var IO + */ + private $io; + + /** + * @param IO $io object to which data is to be written. + * + */ + function __construct(IO $io) + { + Avro::check_platform(); + $this->io = $io; + } + + /** + * @param null $datum actual value is ignored + */ + function write_null($datum) + { + return null; + } + + /** + * @param boolean $datum + */ + function write_boolean($datum) + { + $byte = $datum ? chr(1) : chr(0); + $this->write($byte); + } + + /** + * @param int $datum + */ + function write_int($datum) + { + $this->write_long($datum); + } + + /** + * @param int $n + */ + function write_long($n) + { + if (Avro::uses_gmp()) + $this->write(GMP::encode_long($n)); + else + $this->write(self::encode_long($n)); + } + + /** + * @param float $datum + * @uses self::float_to_int_bits() + */ + public function write_float($datum) + { + $this->write(self::float_to_int_bits($datum)); + } + + /** + * @param float $datum + * @uses self::double_to_long_bits() + */ + public function write_double($datum) + { + $this->write(self::double_to_long_bits($datum)); + } + + /** + * @param string $str + * @uses self::write_bytes() + */ + function write_string($str) + { + $this->write_bytes($str); + } + + /** + * @param string $bytes + */ + function write_bytes($bytes) + { + $this->write_long(strlen($bytes)); + $this->write($bytes); + } + + /** + * @param string $datum + */ + function write($datum) + { + $this->io->write($datum); + } +} \ No newline at end of file diff --git a/src/Avro/Datum/IODatumReader.php b/src/Avro/Datum/IODatumReader.php new file mode 100644 index 0000000..63697f3 --- /dev/null +++ b/src/Avro/Datum/IODatumReader.php @@ -0,0 +1,422 @@ +type; + $readers_schema_type = $readers_schema->type; + + if (Schema::UNION_SCHEMA == $writers_schema_type + || Schema::UNION_SCHEMA == $readers_schema_type + ) + return true; + + if ($writers_schema_type == $readers_schema_type) { + if (Schema::is_primitive_type($writers_schema_type)) + return true; + + switch ($readers_schema_type) { + case Schema::MAP_SCHEMA: + return self::attributes_match($writers_schema->values(), + $readers_schema->values(), + array(Schema::TYPE_ATTR)); + case Schema::ARRAY_SCHEMA: + return self::attributes_match($writers_schema->items(), + $readers_schema->items(), + array(Schema::TYPE_ATTR)); + case Schema::ENUM_SCHEMA: + return self::attributes_match($writers_schema, $readers_schema, + array(Schema::FULLNAME_ATTR)); + case Schema::FIXED_SCHEMA: + return self::attributes_match($writers_schema, $readers_schema, + array(Schema::FULLNAME_ATTR, + Schema::SIZE_ATTR)); + case Schema::RECORD_SCHEMA: + case Schema::ERROR_SCHEMA: + return self::attributes_match($writers_schema, $readers_schema, + array(Schema::FULLNAME_ATTR)); + case Schema::REQUEST_SCHEMA: + // XXX: This seems wrong + return true; + // XXX: no default + } + + if (Schema::INT_TYPE == $writers_schema_type + && in_array($readers_schema_type, array(Schema::LONG_TYPE, + Schema::FLOAT_TYPE, + Schema::DOUBLE_TYPE)) + ) + return true; + + if (Schema::LONG_TYPE == $writers_schema_type + && in_array($readers_schema_type, array(Schema::FLOAT_TYPE, + Schema::DOUBLE_TYPE)) + ) + return true; + + if (Schema::FLOAT_TYPE == $writers_schema_type + && Schema::DOUBLE_TYPE == $readers_schema_type + ) + return true; + + return false; + } + + } + + /** + * Checks equivalence of the given attributes of the two given schemas. + * + * @param Schema $schema_one + * @param Schema $schema_two + * @param string[] $attribute_names array of string attribute names to compare + * + * @returns boolean true if the attributes match and false otherwise. + */ + static function attributes_match(Schema $schema_one, Schema $schema_two, $attribute_names) + { + foreach ($attribute_names as $attribute_name) + if ($schema_one->attribute($attribute_name) + != $schema_two->attribute($attribute_name) + ) + return false; + return true; + } + + /** + * @var Schema + */ + private $writers_schema; + + /** + * @var Schema + */ + private $readers_schema; + + /** + * @param Schema $writers_schema + * @param Schema $readers_schema + */ + function __construct(Schema $writers_schema = null, Schema $readers_schema = null) + { + $this->writers_schema = $writers_schema; + $this->readers_schema = $readers_schema; + } + + /** + * @param Schema $readers_schema + */ + public function set_writers_schema(Schema $readers_schema) + { + $this->writers_schema = $readers_schema; + } + + /** + * @param IOBinaryDecoder $decoder + * @returns string + */ + public function read(IOBinaryDecoder $decoder) + { + if (is_null($this->readers_schema)) + $this->readers_schema = $this->writers_schema; + return $this->read_data($this->writers_schema, $this->readers_schema, + $decoder); + } + + /**#@+ + * @param Schema $writers_schema + * @param Schema $readers_schema + * @param IOBinaryDecoder $decoder + */ + /** + * @returns mixed + */ + public function read_data(Schema $writers_schema, Schema $readers_schema, IOBinaryDecoder $decoder) + { + if (!self::schemas_match($writers_schema, $readers_schema)) + throw new IOSchemaMatchException($writers_schema, $readers_schema); + + // Schema resolution: reader's schema is a union, writer's schema is not + if (Schema::UNION_SCHEMA == $readers_schema->type() + && Schema::UNION_SCHEMA != $writers_schema->type() + ) { + foreach ($readers_schema->schemas() as $schema) + if (self::schemas_match($writers_schema, $schema)) + return $this->read_data($writers_schema, $schema, $decoder); + throw new IOSchemaMatchException($writers_schema, $readers_schema); + } + + switch ($writers_schema->type()) { + case Schema::NULL_TYPE: + return $decoder->read_null(); + case Schema::BOOLEAN_TYPE: + return $decoder->read_boolean(); + case Schema::INT_TYPE: + return $decoder->read_int(); + case Schema::LONG_TYPE: + return $decoder->read_long(); + case Schema::FLOAT_TYPE: + return $decoder->read_float(); + case Schema::DOUBLE_TYPE: + return $decoder->read_double(); + case Schema::STRING_TYPE: + return $decoder->read_string(); + case Schema::BYTES_TYPE: + return $decoder->read_bytes(); + case Schema::ARRAY_SCHEMA: + return $this->read_array($writers_schema, $readers_schema, $decoder); + case Schema::MAP_SCHEMA: + return $this->read_map($writers_schema, $readers_schema, $decoder); + case Schema::UNION_SCHEMA: + return $this->read_union($writers_schema, $readers_schema, $decoder); + case Schema::ENUM_SCHEMA: + return $this->read_enum($writers_schema, $readers_schema, $decoder); + case Schema::FIXED_SCHEMA: + return $this->read_fixed($writers_schema, $readers_schema, $decoder); + case Schema::RECORD_SCHEMA: + case Schema::ERROR_SCHEMA: + case Schema::REQUEST_SCHEMA: + return $this->read_record($writers_schema, $readers_schema, $decoder); + default: + throw new Exception(sprintf("Cannot read unknown schema type: %s", + $writers_schema->type())); + } + } + + /** + * @returns array + */ + public function read_array(Schema $writers_schema, Schema $readers_schema, IOBinaryDecoder $decoder) + { + $items = array(); + $block_count = $decoder->read_long(); + while (0 != $block_count) { + if ($block_count < 0) { + $block_count = -$block_count; + $block_size = $decoder->read_long(); // Read (and ignore) block size + } + for ($i = 0; $i < $block_count; $i++) + $items [] = $this->read_data($writers_schema->items(), + $readers_schema->items(), + $decoder); + $block_count = $decoder->read_long(); + } + return $items; + } + + /** + * @returns array + */ + public function read_map(Schema $writers_schema, Schema $readers_schema, IOBinaryDecoder $decoder) + { + $items = array(); + $pair_count = $decoder->read_long(); + while (0 != $pair_count) { + if ($pair_count < 0) { + $pair_count = -$pair_count; + // Note: we're not doing anything with block_size other than skipping it + $block_size = $decoder->read_long(); + } + + for ($i = 0; $i < $pair_count; $i++) { + $key = $decoder->read_string(); + + $items[$key] = $this->read_data($writers_schema->values(), + $readers_schema->values(), + $decoder); + } + $pair_count = $decoder->read_long(); + } + return $items; + } + + /** + * @returns mixed + */ + public function read_union(Schema $writers_schema, Schema $readers_schema, IOBinaryDecoder $decoder) + { + $schema_index = $decoder->read_long(); + + $selected_writers_schema = $writers_schema->schema_by_index($schema_index); + return $this->read_data($selected_writers_schema, $readers_schema, $decoder); + } + + /** + * @returns string + */ + public function read_enum(Schema $writers_schema, Schema $readers_schema, IOBinaryDecoder $decoder) + { + $symbol_index = $decoder->read_int(); + $symbol = $writers_schema->symbol_by_index($symbol_index); + if (!$readers_schema->has_symbol($symbol)) + null; // FIXME: unset wrt schema resolution + return $symbol; + } + + /** + * @returns string + */ + public function read_fixed(Schema $writers_schema, Schema $readers_schema, IOBinaryDecoder $decoder) + { + return $decoder->read($writers_schema->size()); + } + + /** + * @returns array + */ + public function read_record(Schema $writers_schema, Schema $readers_schema, IOBinaryDecoder $decoder) + { + $readers_fields = $readers_schema->fields_hash(); + $record = array(); + foreach ($writers_schema->fields() as $writers_field) { + $type = $writers_field->type(); + if (isset($readers_fields[$writers_field->name()])) + $record[$writers_field->name()] + = $this->read_data($type, + $readers_fields[$writers_field->name()]->type(), + $decoder); + else + $this->skip_data($type, $decoder); + } + // Fill in default values + if (count($readers_fields) > count($record)) { + $writers_fields = $writers_schema->fields_hash(); + foreach ($readers_fields as $field_name => $field) { + if (!isset($writers_fields[$field_name])) { + if ($field->has_default_value()) + $record[$field->name()] + = $this->read_default_value($field->type(), + $field->default_value()); + else + null; // FIXME: unset + } + } + } + + return $record; + } + /**#@-*/ + + /** + * @param Schema $field_schema + * @param null|boolean|int|float|string|array $default_value + * @returns null|boolean|int|float|string|array + * + * @throws Exception if $field_schema type is unknown. + */ + public function read_default_value(Schema $field_schema, $default_value) + { + switch ($field_schema->type()) { + case Schema::NULL_TYPE: + return null; + case Schema::BOOLEAN_TYPE: + return $default_value; + case Schema::INT_TYPE: + case Schema::LONG_TYPE: + return (int)$default_value; + case Schema::FLOAT_TYPE: + case Schema::DOUBLE_TYPE: + return (float)$default_value; + case Schema::STRING_TYPE: + case Schema::BYTES_TYPE: + return $default_value; + case Schema::ARRAY_SCHEMA: + $array = array(); + foreach ($default_value as $json_val) { + $val = $this->read_default_value($field_schema->items(), $json_val); + $array [] = $val; + } + return $array; + case Schema::MAP_SCHEMA: + $map = array(); + foreach ($default_value as $key => $json_val) + $map[$key] = $this->read_default_value($field_schema->values(), + $json_val); + return $map; + case Schema::UNION_SCHEMA: + return $this->read_default_value($field_schema->schema_by_index(0), + $default_value); + case Schema::ENUM_SCHEMA: + case Schema::FIXED_SCHEMA: + return $default_value; + case Schema::RECORD_SCHEMA: + $record = array(); + foreach ($field_schema->fields() as $field) { + $field_name = $field->name(); + if (!$json_val = $default_value[$field_name]) + $json_val = $field->default_value(); + + $record[$field_name] = $this->read_default_value($field->type(), + $json_val); + } + return $record; + default: + throw new Exception(sprintf('Unknown type: %s', $field_schema->type())); + } + } + + /** + * @param Schema $writers_schema + * @param IOBinaryDecoder $decoder + */ + private function skip_data(Schema $writers_schema, IOBinaryDecoder $decoder) + { + switch ($writers_schema->type()) { + case Schema::NULL_TYPE: + return $decoder->skip_null(); + case Schema::BOOLEAN_TYPE: + return $decoder->skip_boolean(); + case Schema::INT_TYPE: + return $decoder->skip_int(); + case Schema::LONG_TYPE: + return $decoder->skip_long(); + case Schema::FLOAT_TYPE: + return $decoder->skip_float(); + case Schema::DOUBLE_TYPE: + return $decoder->skip_double(); + case Schema::STRING_TYPE: + return $decoder->skip_string(); + case Schema::BYTES_TYPE: + return $decoder->skip_bytes(); + case Schema::ARRAY_SCHEMA: + return $decoder->skip_array($writers_schema, $decoder); + case Schema::MAP_SCHEMA: + return $decoder->skip_map($writers_schema, $decoder); + case Schema::UNION_SCHEMA: + return $decoder->skip_union($writers_schema, $decoder); + case Schema::ENUM_SCHEMA: + return $decoder->skip_enum($writers_schema, $decoder); + case Schema::FIXED_SCHEMA: + return $decoder->skip_fixed($writers_schema, $decoder); + case Schema::RECORD_SCHEMA: + case Schema::ERROR_SCHEMA: + case Schema::REQUEST_SCHEMA: + return $decoder->skip_record($writers_schema, $decoder); + default: + throw new Exception(sprintf('Uknown schema type: %s', + $writers_schema->type())); + } + } +} \ No newline at end of file diff --git a/src/Avro/Datum/IODatumWriter.php b/src/Avro/Datum/IODatumWriter.php new file mode 100644 index 0000000..c868909 --- /dev/null +++ b/src/Avro/Datum/IODatumWriter.php @@ -0,0 +1,161 @@ +writers_schema = $writers_schema; + } + + /** + * @param Schema $writers_schema + * @param $datum + * @param IOBinaryEncoder $encoder + * @returns mixed + * + * @throws IOTypeException if $datum is invalid for $writers_schema + */ + function write_data(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { + if (!Schema::is_valid_datum($writers_schema, $datum)) + throw new IOTypeException($writers_schema, $datum); + + switch ($writers_schema->type()) { + case Schema::NULL_TYPE: + return $encoder->write_null($datum); + case Schema::BOOLEAN_TYPE: + return $encoder->write_boolean($datum); + case Schema::INT_TYPE: + return $encoder->write_int($datum); + case Schema::LONG_TYPE: + return $encoder->write_long($datum); + case Schema::FLOAT_TYPE: + return $encoder->write_float($datum); + case Schema::DOUBLE_TYPE: + return $encoder->write_double($datum); + case Schema::STRING_TYPE: + return $encoder->write_string($datum); + case Schema::BYTES_TYPE: + return $encoder->write_bytes($datum); + case Schema::ARRAY_SCHEMA: + return $this->write_array($writers_schema, $datum, $encoder); + case Schema::MAP_SCHEMA: + return $this->write_map($writers_schema, $datum, $encoder); + case Schema::FIXED_SCHEMA: + return $this->write_fixed($writers_schema, $datum, $encoder); + case Schema::ENUM_SCHEMA: + return $this->write_enum($writers_schema, $datum, $encoder); + case Schema::RECORD_SCHEMA: + case Schema::ERROR_SCHEMA: + case Schema::REQUEST_SCHEMA: + return $this->write_record($writers_schema, $datum, $encoder); + case Schema::UNION_SCHEMA: + return $this->write_union($writers_schema, $datum, $encoder); + default: + throw new Exception(sprintf('Uknown type: %s', + $writers_schema->type)); + } + } + + /** + * @param $datum + * @param IOBinaryEncoder $encoder + */ + function write($datum, IOBinaryEncoder $encoder) + { + $this->write_data($this->writers_schema, $datum, $encoder); + } + + /**#@+ + * @param Schema $writers_schema + * @param null|boolean|int|float|string|array $datum item to be written + * @param IOBinaryEncoder $encoder + */ + private function write_array(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { + $datum_count = count($datum); + if (0 < $datum_count) { + $encoder->write_long($datum_count); + $items = $writers_schema->items(); + foreach ($datum as $item) + $this->write_data($items, $item, $encoder); + } + return $encoder->write_long(0); + } + + private function write_map(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { + $datum_count = count($datum); + if ($datum_count > 0) { + $encoder->write_long($datum_count); + foreach ($datum as $k => $v) { + $encoder->write_string($k); + $this->write_data($writers_schema->values(), $v, $encoder); + } + } + $encoder->write_long(0); + } + + private function write_union(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { + $datum_schema_index = -1; + $datum_schema = null; + foreach ($writers_schema->schemas() as $index => $schema) + if (Schema::is_valid_datum($schema, $datum)) { + $datum_schema_index = $index; + $datum_schema = $schema; + break; + } + + if (is_null($datum_schema)) + throw new IOTypeException($writers_schema, $datum); + + $encoder->write_long($datum_schema_index); + $this->write_data($datum_schema, $datum, $encoder); + } + + private function write_enum(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { + $datum_index = $writers_schema->symbol_index($datum); + return $encoder->write_int($datum_index); + } + + private function write_fixed(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { + /** + * NOTE Unused $writers_schema parameter included for consistency + * with other write_* methods. + */ + return $encoder->write($datum); + } + + private function write_record(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) + { + foreach ($writers_schema->fields() as $field) + $this->write_data($field->type(), $datum[$field->name()], $encoder); + } + + /**#@-*/ +} \ No newline at end of file diff --git a/src/Avro/Debug/Debug.php b/src/Avro/Debug/Debug.php new file mode 100644 index 0000000..53d792f --- /dev/null +++ b/src/Avro/Debug/Debug.php @@ -0,0 +1,175 @@ += $debug_level); + } + + /** + * @param string $format format string for the given arguments. Passed as is + * to vprintf. + * @param array $args array of arguments to pass to vsprinf. + * @param int $debug_level debug level at which to print this statement + * @returns boolean true + */ + static function debug($format, $args, $debug_level = self::DEBUG1) + { + if (self::is_debug($debug_level)) + vprintf($format . "\n", $args); + return true; + } + + /** + * @param string $str + * @returns string[] array of hex representation of each byte of $str + */ + static function hex_array($str) + { + return self::bytes_array($str); + } + + /** + * @param string $str + * @param string $joiner string used to join + * @returns string hex-represented bytes of each byte of $str + * joined by $joiner + */ + static function hex_string($str, $joiner = ' ') + { + return join($joiner, self::hex_array($str)); + } + + /** + * @param string $str + * @param string $format format to represent bytes + * @returns string[] array of each byte of $str formatted using $format + */ + static function bytes_array($str, $format = 'x%02x') + { + $x = array(); + foreach (str_split($str) as $b) + $x [] = sprintf($format, ord($b)); + return $x; + } + + /** + * @param string $str + * @returns string[] array of bytes of $str represented in decimal format ('%3d') + */ + static function dec_array($str) + { + return self::bytes_array($str, '%3d'); + } + + /** + * @param string $str + * @param string $joiner string to join bytes of $str + * @returns string of bytes of $str represented in decimal format + * @uses dec_array() + */ + static function dec_string($str, $joiner = ' ') + { + return join($joiner, self::dec_array($str)); + } + + /** + * @param string $str + * @param string $format one of 'ctrl', 'hex', or 'dec' for control, + * hexadecimal, or decimal format for bytes. + * - ctrl: ASCII control characters represented as text. + * For example, the null byte is represented as 'NUL'. + * Visible ASCII characters represent themselves, and + * others are represented as a decimal ('%03d') + * - hex: bytes represented in hexadecimal ('%02X') + * - dec: bytes represented in decimal ('%03d') + * @returns string[] array of bytes represented in the given format. + */ + static function ascii_array($str, $format = 'ctrl') + { + if (!in_array($format, array('ctrl', 'hex', 'dec'))) + throw new Exception('Unrecognized format specifier'); + + $ctrl_chars = array('NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', + 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', + 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', + 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US'); + $x = array(); + foreach (str_split($str) as $b) { + $db = ord($b); + if ($db < 32) { + switch ($format) { + case 'ctrl': + $x [] = str_pad($ctrl_chars[$db], 3, ' ', STR_PAD_LEFT); + break; + case 'hex': + $x [] = sprintf("x%02X", $db); + break; + case 'dec': + $x [] = str_pad($db, 3, '0', STR_PAD_LEFT); + break; + } + } else if ($db < 127) + $x [] = " $b"; + else if ($db == 127) { + switch ($format) { + case 'ctrl': + $x [] = 'DEL'; + break; + case 'hex': + $x [] = sprintf("x%02X", $db); + break; + case 'dec': + $x [] = str_pad($db, 3, '0', STR_PAD_LEFT); + break; + } + } else + if ('hex' == $format) + $x [] = sprintf("x%02X", $db); + else + $x [] = str_pad($db, 3, '0', STR_PAD_LEFT); + } + return $x; + } + + /** + * @param string $str + * @param string $format one of 'ctrl', 'hex', or 'dec'. + * See {@link self::ascii_array()} for more description + * @param string $joiner + * @returns string of bytes joined by $joiner + * @uses ascii_array() + */ + static function ascii_string($str, $format = 'ctrl', $joiner = ' ') + { + return join($joiner, self::ascii_array($str, $format)); + } +} diff --git a/src/Avro/Exception/DataIoException.php b/src/Avro/Exception/DataIoException.php new file mode 100644 index 0000000..b757b8f --- /dev/null +++ b/src/Avro/Exception/DataIoException.php @@ -0,0 +1,8 @@ + gmp_sign($g)) + $g = self::gmp_twos_complement($g); + + $m = gmp_mul($g, gmp_pow(self::gmp_2(), $shift)); + $m = gmp_and($m, self::gmp_0xfs()); + if (gmp_testbit($m, 63)) + $m = gmp_neg(gmp_add(gmp_and(gmp_com($m), self::gmp_0xfs()), + self::gmp_1())); + return $m; + } + + /** + * Arithmetic right shift + * @param resource|int|string $g + * @param int $shift number of bits to shift right + * @returns resource $g shifted right $shift bits + */ + static function shift_right($g, $shift) + { + if (0 == $shift) + return $g; + + if (0 <= gmp_sign($g)) + $m = gmp_div($g, gmp_pow(self::gmp_2(), $shift)); + else // negative + { + $g = gmp_and($g, self::gmp_0xfs()); + $m = gmp_div($g, gmp_pow(self::gmp_2(), $shift)); + $m = gmp_and($m, self::gmp_0xfs()); + for ($i = 63; $i >= (63 - $shift); $i--) + gmp_setbit($m, $i); + + $m = gmp_neg(gmp_add(gmp_and(gmp_com($m), self::gmp_0xfs()), + self::gmp_1())); + } + + return $m; + } + + /** + * @param int|str $n integer (or string representation of integer) to encode + * @return string $bytes of the long $n encoded per the Avro spec + */ + static function encode_long($n) + { + $g = gmp_init($n); + $g = gmp_xor(self::shift_left($g, 1), + self::shift_right($g, 63)); + $bytes = ''; + while (0 != gmp_cmp(self::gmp_0(), gmp_and($g, self::gmp_n0x7f()))) { + $bytes .= chr(gmp_intval(gmp_and($g, self::gmp_0x7f())) | 0x80); + $g = self::shift_right($g, 7); + } + $bytes .= chr(gmp_intval($g)); + return $bytes; + } + + /** + * @param int[] $bytes array of ascii codes of bytes to decode + * @return string represenation of decoded long. + */ + static function decode_long_from_array($bytes) + { + $b = array_shift($bytes); + $g = gmp_init($b & 0x7f); + $shift = 7; + while (0 != ($b & 0x80)) { + $b = array_shift($bytes); + $g = gmp_or($g, self::shift_left(($b & 0x7f), $shift)); + $shift += 7; + } + $val = gmp_xor(self::shift_right($g, 1), gmp_neg(gmp_and($g, 1))); + return gmp_strval($val); + } + +} \ No newline at end of file diff --git a/src/Avro/IO/File.php b/src/Avro/IO/File.php new file mode 100644 index 0000000..c426970 --- /dev/null +++ b/src/Avro/IO/File.php @@ -0,0 +1,160 @@ +file_path = $file_path; + switch ($mode) { + case self::WRITE_MODE: + $this->file_handle = fopen($this->file_path, self::FOPEN_WRITE_MODE); + if (false == $this->file_handle) + throw new IOException('Could not open file for writing'); + break; + case self::READ_MODE: + $this->file_handle = fopen($this->file_path, self::FOPEN_READ_MODE); + if (false == $this->file_handle) + throw new IOException('Could not open file for reading'); + break; + default: + throw new IOException( + sprintf("Only modes '%s' and '%s' allowed. You provided '%s'.", + self::READ_MODE, self::WRITE_MODE, $mode)); + } + } + + /** + * @returns int count of bytes written + * @throws IOException if write failed. + */ + public function write($str) + { + $len = fwrite($this->file_handle, $str); + if (false === $len) + throw new IOException(sprintf('Could not write to file')); + return $len; + } + + /** + * @param int $len count of bytes to read. + * @returns string bytes read + * @throws IOException if length value is negative or if the read failed + */ + public function read($len) + { + if (0 > $len) + throw new IOException( + sprintf("Invalid length value passed to read: %d", $len)); + + if (0 == $len) + return ''; + + $bytes = fread($this->file_handle, $len); + if (false === $bytes) + throw new IOException('Could not read from file'); + return $bytes; + } + + /** + * @returns int current position within the file + * @throws FileExcpetion if tell failed. + */ + public function tell() + { + $position = ftell($this->file_handle); + if (false === $position) { + throw new IOException('Could not execute tell on reader'); + } + return $position; + } + + /** + * @param int $offset + * @param int $whence + * @returns boolean true upon success + * @throws IOException if seek failed. + * @see IO::seek() + */ + public function seek($offset, $whence = SEEK_SET) + { + $res = fseek($this->file_handle, $offset, $whence); + // Note: does not catch seeking beyond end of file + if (-1 === $res) + throw new IOException( + sprintf("Could not execute seek (offset = %d, whence = %d)", + $offset, $whence)); + return true; + } + + /** + * Closes the file. + * @returns boolean true if successful. + * @throws IOException if there was an error closing the file. + */ + public function close() + { + $res = fclose($this->file_handle); + if (false === $res) + throw new IOException('Error closing file.'); + return $res; + } + + /** + * @returns boolean true if the pointer is at the end of the file, + * and false otherwise. + * @see IO::is_eof() as behavior differs from feof() + */ + public function is_eof() + { + $this->read(1); + if (feof($this->file_handle)) + return true; + $this->seek(-1, self::SEEK_CUR); + return false; + } + + /** + * @returns boolean true if the flush was successful. + * @throws IOException if there was an error flushing the file. + */ + public function flush() + { + $res = fflush($this->file_handle); + if (false === $res) + throw new IOException('Could not flush file.'); + return true; + } + +} \ No newline at end of file diff --git a/src/Avro/IO/IO.php b/src/Avro/IO/IO.php new file mode 100644 index 0000000..376c37b --- /dev/null +++ b/src/Avro/IO/IO.php @@ -0,0 +1,116 @@ +not like eof in C or feof in PHP: + * it returns TRUE if the *next* read would be end of file, + * rather than if the *most recent* read read end of file. + * @returns boolean true if at the end of file, and false otherwise + */ + public function is_eof() + { + throw new NotImplementedException('Not implemented'); + } + + /** + * Closes this IO instance. + */ + public function close() + { + throw new NotImplementedException('Not implemented'); + } + +} \ No newline at end of file diff --git a/src/Avro/IO/StringIO.php b/src/Avro/IO/StringIO.php new file mode 100644 index 0000000..0158f7d --- /dev/null +++ b/src/Avro/IO/StringIO.php @@ -0,0 +1,224 @@ +is_closed = false; + $this->string_buffer = ''; + $this->current_index = 0; + + if (is_string($str)) { + $this->string_buffer .= $str; + } else { + throw new IOException( + sprintf('constructor argument must be a string: %s', gettype($str))); + } + } + + /** + * Append bytes to this buffer. + * (Nothing more is needed to support Avro.) + * @param str $arg bytes to write + * @returns int count of bytes written. + * @throws IOException if $args is not a string value. + */ + public function write($arg) + { + $this->check_closed(); + if (is_string($arg)) + return $this->append_str($arg); + throw new IOException( + sprintf('write argument must be a string: (%s) %s', + gettype($arg), var_export($arg, true))); + } + + /** + * @returns string bytes read from buffer + * @todo test for fencepost errors wrt updating current_index + */ + public function read($len) + { + $this->check_closed(); + $read = ''; + + for ($i = $this->current_index; $i < ($this->current_index + $len); $i++) + $read .= $this->string_buffer[$i]; + if (strlen($read) < $len) + $this->current_index = $this->length(); + else + $this->current_index += $len; + return $read; + } + + /** + * @returns boolean true if successful + * @throws IOException if the seek failed. + */ + public function seek($offset, $whence = self::SEEK_SET) + { + if (!is_int($offset)) + throw new IOException('Seek offset must be an integer.'); + // Prevent seeking before BOF + switch ($whence) { + case self::SEEK_SET: + if (0 > $offset) + throw new IOException('Cannot seek before beginning of file.'); + $this->current_index = $offset; + break; + case self::SEEK_CUR: + if (0 > $this->current_index + $whence) + throw new IOException('Cannot seek before beginning of file.'); + $this->current_index += $offset; + break; + case self::SEEK_END: + if (0 > $this->length() + $offset) + throw new IOException('Cannot seek before beginning of file.'); + $this->current_index = $this->length() + $offset; + break; + default: + throw new IOException(sprintf('Invalid seek whence %d', $whence)); + } + + return true; + } + + /** + * @returns int + * @see IO::tell() + */ + public function tell() + { + return $this->current_index; + } + + /** + * @returns boolean + * @see IO::is_eof() + */ + public function is_eof() + { + return ($this->current_index >= $this->length()); + } + + /** + * No-op provided for compatibility with IO interface. + * @returns boolean true + */ + public function flush() + { + return true; + } + + /** + * Marks this buffer as closed. + * @returns boolean true + */ + public function close() + { + $this->check_closed(); + $this->is_closed = true; + return true; + } + + /** + * @throws IOException if the buffer is closed. + */ + private function check_closed() + { + if ($this->is_closed()) { + throw new IOException('Buffer is closed'); + } + } + + /** + * Appends bytes to this buffer. + * @param string $str + * @returns integer count of bytes written. + */ + private function append_str($str) + { + $this->check_closed(); + $this->string_buffer .= $str; + $len = strlen($str); + $this->current_index += $len; + return $len; + } + + /** + * Truncates the truncate buffer to 0 bytes and returns the pointer + * to the beginning of the buffer. + * @returns boolean true + */ + public function truncate() + { + $this->check_closed(); + $this->string_buffer = ''; + $this->current_index = 0; + return true; + } + + /** + * @returns int count of bytes in the buffer + * @internal Could probably memoize length for performance, but + * no need do this yet. + */ + public function length() + { + return strlen($this->string_buffer); + } + + /** + * @returns string + */ + public function __toString() + { + return $this->string_buffer; + } + + + /** + * @returns string + * @uses self::__toString() + */ + public function string() + { + return $this->__toString(); + } + + /** + * @returns boolean true if this buffer is closed and false + * otherwise. + */ + public function is_closed() + { + return $this->is_closed; + } +} \ No newline at end of file diff --git a/src/Avro/Protocol/Protocol.php b/src/Avro/Protocol/Protocol.php new file mode 100644 index 0000000..56dd198 --- /dev/null +++ b/src/Avro/Protocol/Protocol.php @@ -0,0 +1,47 @@ +real_parse(json_decode($json, true)); + return $protocol; + } + + function real_parse($avro) + { + $this->protocol = $avro["protocol"]; + $this->namespace = $avro["namespace"]; + $this->schemata = new NamedSchemata(); + $this->name = $avro["protocol"]; + + if (!is_null($avro["types"])) { + $types = Schema::real_parse($avro["types"], $this->namespace, $this->schemata); + } + + if (!is_null($avro["messages"])) { + foreach ($avro["messages"] as $messageName => $messageAvro) { + $message = new ProtocolMessage($messageName, $messageAvro, $this); + $this->messages{$messageName} = $message; + } + } + } +} \ No newline at end of file diff --git a/src/Avro/Protocol/ProtocolMessage.php b/src/Avro/Protocol/ProtocolMessage.php new file mode 100644 index 0000000..15f94e3 --- /dev/null +++ b/src/Avro/Protocol/ProtocolMessage.php @@ -0,0 +1,30 @@ +name = $name; + $this->request = new RecordSchema(new Name($name, null, $protocol->namespace), null, $avro{'request'}, $protocol->schemata, Schema::REQUEST_SCHEMA); + + if (array_key_exists('response', $avro)) { + $this->response = $protocol->schemata->schema_by_name(new Name($avro{'response'}, $protocol->namespace, $protocol->namespace)); + if ($this->response == null) + $this->response = new PrimitiveSchema($avro{'response'}); + } + } +} \ No newline at end of file diff --git a/src/Avro/Schema/ArraySchema.php b/src/Avro/Schema/ArraySchema.php new file mode 100644 index 0000000..3ab8629 --- /dev/null +++ b/src/Avro/Schema/ArraySchema.php @@ -0,0 +1,67 @@ +items + * is an Name or an Schema? + */ + private $is_items_schema_from_schemata; + + /** + * @param string|mixed $items NamedSchema name or object form + * of decoded JSON schema representation. + * @param string $default_namespace namespace of enclosing schema + * @param NamedSchemata &$schemata + */ + public function __construct($items, $default_namespace, NamedSchemata &$schemata = null) + { + parent::__construct(Schema::ARRAY_SCHEMA); + + $this->is_items_schema_from_schemata = false; + $items_schema = null; + if (is_string($items) + && $items_schema = $schemata->schema_by_name( + new Name($items, null, $default_namespace)) + ) + $this->is_items_schema_from_schemata = true; + else + $items_schema = Schema::subparse($items, $default_namespace, $schemata); + + $this->items = $items_schema; + } + + + /** + * @returns Name|Schema named schema name or Schema + * of this array schema's elements. + */ + public function items() + { + return $this->items; + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = parent::to_avro(); + $avro[Schema::ITEMS_ATTR] = $this->is_items_schema_from_schemata + ? $this->items->qualified_name() : $this->items->to_avro(); + return $avro; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/EnumSchema.php b/src/Avro/Schema/EnumSchema.php new file mode 100644 index 0000000..ead9929 --- /dev/null +++ b/src/Avro/Schema/EnumSchema.php @@ -0,0 +1,95 @@ + count($symbols)) + throw new SchemaParseException( + sprintf('Duplicate symbols: %s', $symbols)); + + foreach ($symbols as $symbol) + if (!is_string($symbol) || empty($symbol)) + throw new SchemaParseException( + sprintf('Enum schema symbol must be a string %', + print_r($symbol, true))); + + parent::__construct(Schema::ENUM_SCHEMA, $name, $doc, $schemata); + $this->symbols = $symbols; + } + + /** + * @returns string[] this enum schema's symbols + */ + public function symbols() + { + return $this->symbols; + } + + /** + * @param string $symbol + * @returns boolean true if the given symbol exists in this + * enum schema and false otherwise + */ + public function has_symbol($symbol) + { + return in_array($symbol, $this->symbols); + } + + /** + * @param int $index + * @returns string enum schema symbol with the given (zero-based) index + */ + public function symbol_by_index($index) + { + if (array_key_exists($index, $this->symbols)) + return $this->symbols[$index]; + throw new Exception(sprintf('Invalid symbol index %d', $index)); + } + + /** + * @param string $symbol + * @returns int the index of the given $symbol in the enum schema + */ + public function symbol_index($symbol) + { + $idx = array_search($symbol, $this->symbols, true); + if (false !== $idx) + return $idx; + throw new Exception(sprintf("Invalid symbol value '%s'", $symbol)); + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = parent::to_avro(); + $avro[Schema::SYMBOLS_ATTR] = $this->symbols; + return $avro; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/Field.php b/src/Avro/Schema/Field.php new file mode 100644 index 0000000..ad5f9c6 --- /dev/null +++ b/src/Avro/Schema/Field.php @@ -0,0 +1,167 @@ +type = $schema; + $this->is_type_from_schemata = $is_type_from_schemata; + $this->name = $name; + $this->has_default = $has_default; + if ($this->has_default) + $this->default = $default; + $this->check_order_value($order); + $this->order = $order; + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = array(Field::FIELD_NAME_ATTR => $this->name); + + $avro[Schema::TYPE_ATTR] = ($this->is_type_from_schemata) + ? $this->type->qualified_name() : $this->type->to_avro(); + + if (isset($this->default)) + $avro[Field::DEFAULT_ATTR] = $this->default; + + if ($this->order) + $avro[Field::ORDER_ATTR] = $this->order; + + return $avro; + } + + /** + * @returns string the name of this field + */ + public function name() + { + return $this->name; + } + + /** + * @returns mixed the default value of this field + */ + public function default_value() + { + return $this->default; + } + + /** + * @returns boolean true if the field has a default and false otherwise + */ + public function has_default_value() + { + return $this->has_default; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/FixedSchema.php b/src/Avro/Schema/FixedSchema.php new file mode 100644 index 0000000..4c68a17 --- /dev/null +++ b/src/Avro/Schema/FixedSchema.php @@ -0,0 +1,53 @@ +size = $size; + } + + /** + * @returns int byte count of this fixed schema data value + */ + public function size() + { + return $this->size; + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = parent::to_avro(); + $avro[Schema::SIZE_ATTR] = $this->size; + return $avro; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/MapSchema.php b/src/Avro/Schema/MapSchema.php new file mode 100644 index 0000000..b1643b3 --- /dev/null +++ b/src/Avro/Schema/MapSchema.php @@ -0,0 +1,66 @@ +values is a string? + */ + private $is_values_schema_from_schemata; + + /** + * @param string|Schema $values + * @param string $default_namespace namespace of enclosing schema + * @param NamedSchemata &$schemata + */ + public function __construct($values, $default_namespace, NamedSchemata &$schemata = null) + { + parent::__construct(Schema::MAP_SCHEMA); + + $this->is_values_schema_from_schemata = false; + $values_schema = null; + if (is_string($values) + && $values_schema = $schemata->schema_by_name( + new Name($values, null, $default_namespace)) + ) + $this->is_values_schema_from_schemata = true; + else + $values_schema = Schema::subparse($values, $default_namespace, + $schemata); + + $this->values = $values_schema; + } + + /** + * @returns XXX|Schema + */ + public function values() + { + return $this->values; + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = parent::to_avro(); + $avro[Schema::VALUES_ATTR] = $this->is_values_schema_from_schemata + ? $this->values->qualified_name() : $this->values->to_avro(); + return $avro; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/Name.php b/src/Avro/Schema/Name.php new file mode 100644 index 0000000..f3910c1 --- /dev/null +++ b/src/Avro/Schema/Name.php @@ -0,0 +1,158 @@ + 1) { + $name = array_pop($parts); + $namespace = join(self::NAME_SEPARATOR, $parts); + } + return array($name, $namespace); + } + + /** + * @returns boolean true if the given name is well-formed + * (is a non-null, non-empty string) and false otherwise + */ + public static function is_well_formed_name($name) + { + return (is_string($name) && !empty($name) + && preg_match(self::NAME_REGEXP, $name)); + } + + /** + * @param string $namespace + * @returns boolean true if namespace is composed of valid names + * @throws SchemaParseException if any of the namespace components + * are invalid. + */ + private static function check_namespace_names($namespace) + { + foreach (explode(self::NAME_SEPARATOR, $namespace) as $n) { + if (empty($n) || (0 == preg_match(self::NAME_REGEXP, $n))) + throw new SchemaParseException(sprintf('Invalid name "%s"', $n)); + } + return true; + } + + /** + * @param string $name + * @param string $namespace + * @returns string + * @throws SchemaParseException if any of the names are not valid. + */ + private static function parse_fullname($name, $namespace) + { + if (!is_string($namespace) || empty($namespace)) + throw new SchemaParseException('Namespace must be a non-empty string.'); + self::check_namespace_names($namespace); + return $namespace . '.' . $name; + } + + /** + * @var string valid names are matched by self::NAME_REGEXP + */ + private $name; + + /** + * @var string + */ + private $namespace; + + /** + * @var string + */ + private $fullname; + + /** + * @var string Name qualified as necessary given its default namespace. + */ + private $qualified_name; + + /** + * @param string $name + * @param string $namespace + * @param string $default_namespace + */ + public function __construct($name, $namespace, $default_namespace) + { + if (!is_string($name) || empty($name)) { + throw new SchemaParseException('Name must be a non-empty string.'); + } + + if (strpos($name, self::NAME_SEPARATOR) + && self::check_namespace_names($name) + ) { + $this->fullname = $name; + } elseif (0 == preg_match(self::NAME_REGEXP, $name)) { + throw new SchemaParseException(sprintf('Invalid name "%s"', $name)); + } elseif (!is_null($namespace)) { + $this->fullname = self::parse_fullname($name, $namespace); + } elseif (!is_null($default_namespace)) { + $this->fullname = self::parse_fullname($name, $default_namespace); + } else { + $this->fullname = $name; + } + + list($this->name, $this->namespace) = self::extract_namespace($this->fullname); + $this->qualified_name = (is_null($this->namespace) + || $this->namespace == $default_namespace) + ? $this->name : $this->fullname; + } + + /** + * @returns array array($name, $namespace) + */ + public function name_and_namespace() + { + return array($this->name, $this->namespace); + } + + /** + * @returns string + */ + public function fullname() + { + return $this->fullname; + } + + /** + * @returns string fullname + * @uses $this->fullname() + */ + public function __toString() + { + return $this->fullname(); + } + + /** + * @returns string name qualified for its context + */ + public function qualified_name() + { + return $this->qualified_name; + } + +} \ No newline at end of file diff --git a/src/Avro/Schema/NamedSchema.php b/src/Avro/Schema/NamedSchema.php new file mode 100644 index 0000000..31911f2 --- /dev/null +++ b/src/Avro/Schema/NamedSchema.php @@ -0,0 +1,73 @@ +name = $name; + + if ($doc && !is_string($doc)) + throw new SchemaParseException('Schema doc attribute must be a string'); + $this->doc = $doc; + + if (!is_null($schemata)) + $schemata = $schemata->clone_with_new_schema($this); + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = parent::to_avro(); + list($name, $namespace) = Name::extract_namespace($this->qualified_name()); + $avro[Schema::NAME_ATTR] = $name; + if ($namespace) + $avro[Schema::NAMESPACE_ATTR] = $namespace; + if (!is_null($this->doc)) + $avro[Schema::DOC_ATTR] = $this->doc; + return $avro; + } + + /** + * @returns string + */ + public function fullname() + { + return $this->name->fullname(); + } + + public function qualified_name() + { + return $this->name->qualified_name(); + } + +} \ No newline at end of file diff --git a/src/Avro/Schema/NamedSchemata.php b/src/Avro/Schema/NamedSchemata.php new file mode 100644 index 0000000..f9827fb --- /dev/null +++ b/src/Avro/Schema/NamedSchemata.php @@ -0,0 +1,86 @@ +schemata = $schemata; + } + + public function list_schemas() + { + var_export($this->schemata); + foreach ($this->schemata as $sch) + print('Schema ' . $sch->__toString() . "\n"); + } + + /** + * @param string $fullname + * @returns boolean true if there exists a schema with the given name + * and false otherwise. + */ + public function has_name($fullname) + { + return array_key_exists($fullname, $this->schemata); + } + + /** + * @param string $fullname + * @returns Schema|null the schema which has the given name, + * or null if there is no schema with the given name. + */ + public function schema($fullname) + { + if (isset($this->schemata[$fullname])) + return $this->schemata[$fullname]; + return null; + } + + /** + * @param Name $name + * @returns Schema|null + */ + public function schema_by_name(Name $name) + { + return $this->schema($name->fullname()); + } + + /** + * Creates a new NamedSchemata instance of this schemata instance + * with the given $schema appended. + * @param NamedSchema schema to add to this existing schemata + * @returns NamedSchemata + */ + public function clone_with_new_schema(NamedSchema $schema) + { + $name = $schema->fullname(); + if (Schema::is_valid_type($name)) { + throw new SchemaParseException( + sprintf('Name "%s" is a reserved type name', $name)); + } else if ($this->has_name($name)) { + throw new SchemaParseException( + sprintf('Name "%s" is already in use', $name)); + } + $schemata = new NamedSchemata($this->schemata); + $schemata->schemata[$name] = $schema; + return $schemata; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/PrimitiveSchema.php b/src/Avro/Schema/PrimitiveSchema.php new file mode 100644 index 0000000..af5cbf7 --- /dev/null +++ b/src/Avro/Schema/PrimitiveSchema.php @@ -0,0 +1,38 @@ +type; + return $avro; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/RecordSchema.php b/src/Avro/Schema/RecordSchema.php new file mode 100644 index 0000000..2687c2d --- /dev/null +++ b/src/Avro/Schema/RecordSchema.php @@ -0,0 +1,138 @@ + $field) { + $name = Util::array_value($field, Field::FIELD_NAME_ATTR); + $type = Util::array_value($field, Schema::TYPE_ATTR); + $order = Util::array_value($field, Field::ORDER_ATTR); + + $default = null; + $has_default = false; + if (array_key_exists(Field::DEFAULT_ATTR, $field)) { + $default = $field[Field::DEFAULT_ATTR]; + $has_default = true; + } + + if (in_array($name, $field_names)) + throw new SchemaParseException( + sprintf("Field name %s is already in use", $name)); + + $is_schema_from_schemata = false; + $field_schema = null; + if (is_string($type) + && $field_schema = $schemata->schema_by_name( + new Name($type, null, $default_namespace)) + ) + $is_schema_from_schemata = true; + else + $field_schema = self::subparse($type, $default_namespace, $schemata); + + $new_field = new Field($name, $field_schema, $is_schema_from_schemata, + $has_default, $default, $order); + $field_names [] = $name; + $fields [] = $new_field; + } + return $fields; + } + + /** + * @var Schema[] array of NamedSchema field definitions of + * this RecordSchema + */ + private $fields; + + /** + * @var array map of field names to field objects. + * @internal Not called directly. Memoization of RecordSchema->fields_hash() + */ + private $fields_hash; + + /** + * @param string $name + * @param string $namespace + * @param string $doc + * @param array $fields + * @param NamedSchemata &$schemata + * @param string $schema_type schema type name + * @throws SchemaParseException + */ + public function __construct($name, $doc, $fields, NamedSchemata &$schemata = null, + $schema_type = Schema::RECORD_SCHEMA) + { + if (is_null($fields)) { + throw new SchemaParseException( + 'Record schema requires a non-empty fields attribute'); + } + + if (Schema::REQUEST_SCHEMA == $schema_type) { + parent::__construct($schema_type, $name); + } else { + parent::__construct($schema_type, $name, $doc, $schemata); + } + + list($x, $namespace) = $name->name_and_namespace(); + $this->fields = self::parse_fields($fields, $namespace, $schemata); + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = parent::to_avro(); + + $fields_avro = array(); + foreach ($this->fields as $field) + $fields_avro [] = $field->to_avro(); + + if (Schema::REQUEST_SCHEMA == $this->type) + return $fields_avro; + + $avro[Schema::FIELDS_ATTR] = $fields_avro; + + return $avro; + } + + /** + * @returns array the schema definitions of the fields of this RecordSchema + */ + public function fields() + { + return $this->fields; + } + + /** + * @returns array a hash table of the fields of this RecordSchema fields + * keyed by each field's name + */ + public function fields_hash() + { + if (is_null($this->fields_hash)) { + $hash = array(); + foreach ($this->fields as $field) + $hash[$field->name()] = $field; + $this->fields_hash = $hash; + } + return $this->fields_hash; + } +} \ No newline at end of file diff --git a/src/Avro/Schema/Schema.php b/src/Avro/Schema/Schema.php new file mode 100644 index 0000000..b384f6b --- /dev/null +++ b/src/Avro/Schema/Schema.php @@ -0,0 +1,465 @@ +type) + { + case self::NULL_TYPE: + return is_null($datum); + case self::BOOLEAN_TYPE: + return is_bool($datum); + case self::STRING_TYPE: + case self::BYTES_TYPE: + return is_string($datum); + case self::INT_TYPE: + return (is_int($datum) + && (self::INT_MIN_VALUE <= $datum) + && ($datum <= self::INT_MAX_VALUE)); + case self::LONG_TYPE: + return (is_int($datum) + && (self::LONG_MIN_VALUE <= $datum) + && ($datum <= self::LONG_MAX_VALUE)); + case self::FLOAT_TYPE: + case self::DOUBLE_TYPE: + return (is_float($datum) || is_int($datum)); + case self::ARRAY_SCHEMA: + if (is_array($datum)) + { + foreach ($datum as $d) + if (!self::is_valid_datum($expected_schema->items(), $d)) + return false; + return true; + } + return false; + case self::MAP_SCHEMA: + if (is_array($datum)) + { + foreach ($datum as $k => $v) + if (!is_string($k) + || !self::is_valid_datum($expected_schema->values(), $v)) + return false; + return true; + } + return false; + case self::UNION_SCHEMA: + foreach ($expected_schema->schemas() as $schema) + if (self::is_valid_datum($schema, $datum)) + return true; + return false; + case self::ENUM_SCHEMA: + return in_array($datum, $expected_schema->symbols()); + case self::FIXED_SCHEMA: + return (is_string($datum) + && (strlen($datum) == $expected_schema->size())); + case self::RECORD_SCHEMA: + case self::ERROR_SCHEMA: + case self::REQUEST_SCHEMA: + if (is_array($datum)) + { + foreach ($expected_schema->fields() as $field) + if (!array_key_exists($field->name(), $datum) || !self::is_valid_datum($field->type(), $datum[$field->name()])) + return false; + return true; + } + return false; + default: + throw new SchemaParseException( + sprintf('%s is not allowed.', $expected_schema)); + } + } + + /** + * @internal Should only be called from within the constructor of + * a class which extends Schema + * @param string $type a schema type name + */ + public function __construct($type) + { + $this->type = $type; + } + + /** + * @param mixed $avro + * @param string $default_namespace namespace of enclosing schema + * @param NamedSchemata &$schemata + * @returns Schema + * @uses Schema::real_parse() + * @throws SchemaParseException + */ + protected static function subparse($avro, $default_namespace, NamedSchemata &$schemata=null) + { + try + { + return self::real_parse($avro, $default_namespace, $schemata); + } + catch (SchemaParseException $e) + { + throw $e; + } + catch (Exception $e) + { + throw new SchemaParseException( + sprintf('Sub-schema is not a valid Avro schema. Bad schema: %s', + print_r($avro, true))); + } + + } + + /** + * @returns string schema type name of this schema + */ + public function type() { return $this->type; } + + /** + * @returns mixed + */ + public function to_avro() + { + return array(self::TYPE_ATTR => $this->type); + } + + /** + * @returns string the JSON-encoded representation of this Avro schema. + */ + public function __toString() { return json_encode($this->to_avro()); } + + /** + * @returns mixed value of the attribute with the given attribute name + */ + public function attribute($attribute) { return $this->$attribute(); } + +} \ No newline at end of file diff --git a/src/Avro/Schema/UnionSchema.php b/src/Avro/Schema/UnionSchema.php new file mode 100644 index 0000000..1efcfd4 --- /dev/null +++ b/src/Avro/Schema/UnionSchema.php @@ -0,0 +1,100 @@ +schema_from_schemata_indices = array(); + $schema_types = array(); + foreach ($schemas as $index => $schema) { + $is_schema_from_schemata = false; + $new_schema = null; + if (is_string($schema) + && ($new_schema = $schemata->schema_by_name( + new Name($schema, null, $default_namespace))) + ) + $is_schema_from_schemata = true; + else + $new_schema = self::subparse($schema, $default_namespace, $schemata); + + $schema_type = $new_schema->type; + if (self::is_valid_type($schema_type) + && !self::is_named_type($schema_type) + && in_array($schema_type, $schema_types) + ) + throw new SchemaParseException( + sprintf('"%s" is already in union', $schema_type)); + elseif (Schema::UNION_SCHEMA == $schema_type) + throw new SchemaParseException('Unions cannot contain other unions'); + else { + $schema_types [] = $schema_type; + $this->schemas [] = $new_schema; + if ($is_schema_from_schemata) + $this->schema_from_schemata_indices [] = $index; + } + } + + } + + /** + * @returns Schema[] + */ + public function schemas() + { + return $this->schemas; + } + + /** + * @returns Schema the particular schema from the union for + * the given (zero-based) index. + * @throws SchemaParseException if the index is invalid for this schema. + */ + public function schema_by_index($index) + { + if (count($this->schemas) > $index) + return $this->schemas[$index]; + + throw new SchemaParseException('Invalid union schema index'); + } + + /** + * @returns mixed + */ + public function to_avro() + { + $avro = array(); + + foreach ($this->schemas as $index => $schema) + $avro [] = (in_array($index, $this->schema_from_schemata_indices)) + ? $schema->qualified_name() : $schema->to_avro(); + + return $avro; + } +} \ No newline at end of file diff --git a/src/Avro/Util/Util.php b/src/Avro/Util/Util.php new file mode 100644 index 0000000..942246e --- /dev/null +++ b/src/Avro/Util/Util.php @@ -0,0 +1,46 @@ + $v) { + if ($i !== $k) + return false; + $i++; + } + return true; + } + return false; + } + + /** + * @param array $ary + * @param string $key + * @returns mixed the value of $ary[$key] if it is set, + * and null otherwise. + */ + static function array_value($ary, $key) + { + return isset($ary[$key]) ? $ary[$key] : null; + } +} \ No newline at end of file From c0cc998cb495e95555008980c89466502a898014 Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 13:01:03 -0500 Subject: [PATCH 38/57] Commits forked avro library because composer patch won't work for composer nested dependencies. --- {src => lib/avro-php}/Avro/Avro.php | 0 {src => lib/avro-php}/Avro/DataIO/DataIO.php | 0 .../avro-php}/Avro/DataIO/DataIOReader.php | 0 .../avro-php}/Avro/DataIO/DataIOWriter.php | 0 .../avro-php}/Avro/Datum/IOBinaryDecoder.php | 0 .../avro-php}/Avro/Datum/IOBinaryEncoder.php | 0 .../avro-php}/Avro/Datum/IODatumReader.php | 0 .../avro-php}/Avro/Datum/IODatumWriter.php | 0 {src => lib/avro-php}/Avro/Debug/Debug.php | 0 .../Avro/Exception/DataIoException.php | 0 .../avro-php}/Avro/Exception/Exception.php | 0 .../avro-php}/Avro/Exception/IOException.php | 0 .../Avro/Exception/IOSchemaMatchException.php | 0 .../Avro/Exception/IOTypeException.php | 0 .../Exception/NotImplementedException.php | 0 .../Avro/Exception/ProtocolParseException.php | 0 .../Avro/Exception/SchemaParseException.php | 0 {src => lib/avro-php}/Avro/GMP/GMP.php | 0 {src => lib/avro-php}/Avro/IO/File.php | 0 {src => lib/avro-php}/Avro/IO/IO.php | 0 {src => lib/avro-php}/Avro/IO/StringIO.php | 0 .../avro-php}/Avro/Protocol/Protocol.php | 0 .../Avro/Protocol/ProtocolMessage.php | 0 .../avro-php}/Avro/Schema/ArraySchema.php | 0 .../avro-php}/Avro/Schema/EnumSchema.php | 0 {src => lib/avro-php}/Avro/Schema/Field.php | 0 .../avro-php}/Avro/Schema/FixedSchema.php | 0 .../avro-php}/Avro/Schema/MapSchema.php | 0 {src => lib/avro-php}/Avro/Schema/Name.php | 0 .../avro-php}/Avro/Schema/NamedSchema.php | 0 .../avro-php}/Avro/Schema/NamedSchemata.php | 0 .../avro-php}/Avro/Schema/PrimitiveSchema.php | 0 .../avro-php}/Avro/Schema/RecordSchema.php | 0 {src => lib/avro-php}/Avro/Schema/Schema.php | 0 .../avro-php}/Avro/Schema/UnionSchema.php | 0 {src => lib/avro-php}/Avro/Util/Util.php | 0 src/AvroDeserializer.php | 3 ++ src/AvroLoader.php | 35 +++++++++++++++++++ src/BulkModels.php | 2 +- src/Model/ModelTrait/MessageTrait.php | 12 ++++--- src/SchemaClient.php | 4 ++- 41 files changed, 49 insertions(+), 7 deletions(-) rename {src => lib/avro-php}/Avro/Avro.php (100%) rename {src => lib/avro-php}/Avro/DataIO/DataIO.php (100%) rename {src => lib/avro-php}/Avro/DataIO/DataIOReader.php (100%) rename {src => lib/avro-php}/Avro/DataIO/DataIOWriter.php (100%) rename {src => lib/avro-php}/Avro/Datum/IOBinaryDecoder.php (100%) rename {src => lib/avro-php}/Avro/Datum/IOBinaryEncoder.php (100%) rename {src => lib/avro-php}/Avro/Datum/IODatumReader.php (100%) rename {src => lib/avro-php}/Avro/Datum/IODatumWriter.php (100%) rename {src => lib/avro-php}/Avro/Debug/Debug.php (100%) rename {src => lib/avro-php}/Avro/Exception/DataIoException.php (100%) rename {src => lib/avro-php}/Avro/Exception/Exception.php (100%) rename {src => lib/avro-php}/Avro/Exception/IOException.php (100%) rename {src => lib/avro-php}/Avro/Exception/IOSchemaMatchException.php (100%) rename {src => lib/avro-php}/Avro/Exception/IOTypeException.php (100%) rename {src => lib/avro-php}/Avro/Exception/NotImplementedException.php (100%) rename {src => lib/avro-php}/Avro/Exception/ProtocolParseException.php (100%) rename {src => lib/avro-php}/Avro/Exception/SchemaParseException.php (100%) rename {src => lib/avro-php}/Avro/GMP/GMP.php (100%) rename {src => lib/avro-php}/Avro/IO/File.php (100%) rename {src => lib/avro-php}/Avro/IO/IO.php (100%) rename {src => lib/avro-php}/Avro/IO/StringIO.php (100%) rename {src => lib/avro-php}/Avro/Protocol/Protocol.php (100%) rename {src => lib/avro-php}/Avro/Protocol/ProtocolMessage.php (100%) rename {src => lib/avro-php}/Avro/Schema/ArraySchema.php (100%) rename {src => lib/avro-php}/Avro/Schema/EnumSchema.php (100%) rename {src => lib/avro-php}/Avro/Schema/Field.php (100%) rename {src => lib/avro-php}/Avro/Schema/FixedSchema.php (100%) rename {src => lib/avro-php}/Avro/Schema/MapSchema.php (100%) rename {src => lib/avro-php}/Avro/Schema/Name.php (100%) rename {src => lib/avro-php}/Avro/Schema/NamedSchema.php (100%) rename {src => lib/avro-php}/Avro/Schema/NamedSchemata.php (100%) rename {src => lib/avro-php}/Avro/Schema/PrimitiveSchema.php (100%) rename {src => lib/avro-php}/Avro/Schema/RecordSchema.php (100%) rename {src => lib/avro-php}/Avro/Schema/Schema.php (100%) rename {src => lib/avro-php}/Avro/Schema/UnionSchema.php (100%) rename {src => lib/avro-php}/Avro/Util/Util.php (100%) create mode 100644 src/AvroLoader.php diff --git a/src/Avro/Avro.php b/lib/avro-php/Avro/Avro.php similarity index 100% rename from src/Avro/Avro.php rename to lib/avro-php/Avro/Avro.php diff --git a/src/Avro/DataIO/DataIO.php b/lib/avro-php/Avro/DataIO/DataIO.php similarity index 100% rename from src/Avro/DataIO/DataIO.php rename to lib/avro-php/Avro/DataIO/DataIO.php diff --git a/src/Avro/DataIO/DataIOReader.php b/lib/avro-php/Avro/DataIO/DataIOReader.php similarity index 100% rename from src/Avro/DataIO/DataIOReader.php rename to lib/avro-php/Avro/DataIO/DataIOReader.php diff --git a/src/Avro/DataIO/DataIOWriter.php b/lib/avro-php/Avro/DataIO/DataIOWriter.php similarity index 100% rename from src/Avro/DataIO/DataIOWriter.php rename to lib/avro-php/Avro/DataIO/DataIOWriter.php diff --git a/src/Avro/Datum/IOBinaryDecoder.php b/lib/avro-php/Avro/Datum/IOBinaryDecoder.php similarity index 100% rename from src/Avro/Datum/IOBinaryDecoder.php rename to lib/avro-php/Avro/Datum/IOBinaryDecoder.php diff --git a/src/Avro/Datum/IOBinaryEncoder.php b/lib/avro-php/Avro/Datum/IOBinaryEncoder.php similarity index 100% rename from src/Avro/Datum/IOBinaryEncoder.php rename to lib/avro-php/Avro/Datum/IOBinaryEncoder.php diff --git a/src/Avro/Datum/IODatumReader.php b/lib/avro-php/Avro/Datum/IODatumReader.php similarity index 100% rename from src/Avro/Datum/IODatumReader.php rename to lib/avro-php/Avro/Datum/IODatumReader.php diff --git a/src/Avro/Datum/IODatumWriter.php b/lib/avro-php/Avro/Datum/IODatumWriter.php similarity index 100% rename from src/Avro/Datum/IODatumWriter.php rename to lib/avro-php/Avro/Datum/IODatumWriter.php diff --git a/src/Avro/Debug/Debug.php b/lib/avro-php/Avro/Debug/Debug.php similarity index 100% rename from src/Avro/Debug/Debug.php rename to lib/avro-php/Avro/Debug/Debug.php diff --git a/src/Avro/Exception/DataIoException.php b/lib/avro-php/Avro/Exception/DataIoException.php similarity index 100% rename from src/Avro/Exception/DataIoException.php rename to lib/avro-php/Avro/Exception/DataIoException.php diff --git a/src/Avro/Exception/Exception.php b/lib/avro-php/Avro/Exception/Exception.php similarity index 100% rename from src/Avro/Exception/Exception.php rename to lib/avro-php/Avro/Exception/Exception.php diff --git a/src/Avro/Exception/IOException.php b/lib/avro-php/Avro/Exception/IOException.php similarity index 100% rename from src/Avro/Exception/IOException.php rename to lib/avro-php/Avro/Exception/IOException.php diff --git a/src/Avro/Exception/IOSchemaMatchException.php b/lib/avro-php/Avro/Exception/IOSchemaMatchException.php similarity index 100% rename from src/Avro/Exception/IOSchemaMatchException.php rename to lib/avro-php/Avro/Exception/IOSchemaMatchException.php diff --git a/src/Avro/Exception/IOTypeException.php b/lib/avro-php/Avro/Exception/IOTypeException.php similarity index 100% rename from src/Avro/Exception/IOTypeException.php rename to lib/avro-php/Avro/Exception/IOTypeException.php diff --git a/src/Avro/Exception/NotImplementedException.php b/lib/avro-php/Avro/Exception/NotImplementedException.php similarity index 100% rename from src/Avro/Exception/NotImplementedException.php rename to lib/avro-php/Avro/Exception/NotImplementedException.php diff --git a/src/Avro/Exception/ProtocolParseException.php b/lib/avro-php/Avro/Exception/ProtocolParseException.php similarity index 100% rename from src/Avro/Exception/ProtocolParseException.php rename to lib/avro-php/Avro/Exception/ProtocolParseException.php diff --git a/src/Avro/Exception/SchemaParseException.php b/lib/avro-php/Avro/Exception/SchemaParseException.php similarity index 100% rename from src/Avro/Exception/SchemaParseException.php rename to lib/avro-php/Avro/Exception/SchemaParseException.php diff --git a/src/Avro/GMP/GMP.php b/lib/avro-php/Avro/GMP/GMP.php similarity index 100% rename from src/Avro/GMP/GMP.php rename to lib/avro-php/Avro/GMP/GMP.php diff --git a/src/Avro/IO/File.php b/lib/avro-php/Avro/IO/File.php similarity index 100% rename from src/Avro/IO/File.php rename to lib/avro-php/Avro/IO/File.php diff --git a/src/Avro/IO/IO.php b/lib/avro-php/Avro/IO/IO.php similarity index 100% rename from src/Avro/IO/IO.php rename to lib/avro-php/Avro/IO/IO.php diff --git a/src/Avro/IO/StringIO.php b/lib/avro-php/Avro/IO/StringIO.php similarity index 100% rename from src/Avro/IO/StringIO.php rename to lib/avro-php/Avro/IO/StringIO.php diff --git a/src/Avro/Protocol/Protocol.php b/lib/avro-php/Avro/Protocol/Protocol.php similarity index 100% rename from src/Avro/Protocol/Protocol.php rename to lib/avro-php/Avro/Protocol/Protocol.php diff --git a/src/Avro/Protocol/ProtocolMessage.php b/lib/avro-php/Avro/Protocol/ProtocolMessage.php similarity index 100% rename from src/Avro/Protocol/ProtocolMessage.php rename to lib/avro-php/Avro/Protocol/ProtocolMessage.php diff --git a/src/Avro/Schema/ArraySchema.php b/lib/avro-php/Avro/Schema/ArraySchema.php similarity index 100% rename from src/Avro/Schema/ArraySchema.php rename to lib/avro-php/Avro/Schema/ArraySchema.php diff --git a/src/Avro/Schema/EnumSchema.php b/lib/avro-php/Avro/Schema/EnumSchema.php similarity index 100% rename from src/Avro/Schema/EnumSchema.php rename to lib/avro-php/Avro/Schema/EnumSchema.php diff --git a/src/Avro/Schema/Field.php b/lib/avro-php/Avro/Schema/Field.php similarity index 100% rename from src/Avro/Schema/Field.php rename to lib/avro-php/Avro/Schema/Field.php diff --git a/src/Avro/Schema/FixedSchema.php b/lib/avro-php/Avro/Schema/FixedSchema.php similarity index 100% rename from src/Avro/Schema/FixedSchema.php rename to lib/avro-php/Avro/Schema/FixedSchema.php diff --git a/src/Avro/Schema/MapSchema.php b/lib/avro-php/Avro/Schema/MapSchema.php similarity index 100% rename from src/Avro/Schema/MapSchema.php rename to lib/avro-php/Avro/Schema/MapSchema.php diff --git a/src/Avro/Schema/Name.php b/lib/avro-php/Avro/Schema/Name.php similarity index 100% rename from src/Avro/Schema/Name.php rename to lib/avro-php/Avro/Schema/Name.php diff --git a/src/Avro/Schema/NamedSchema.php b/lib/avro-php/Avro/Schema/NamedSchema.php similarity index 100% rename from src/Avro/Schema/NamedSchema.php rename to lib/avro-php/Avro/Schema/NamedSchema.php diff --git a/src/Avro/Schema/NamedSchemata.php b/lib/avro-php/Avro/Schema/NamedSchemata.php similarity index 100% rename from src/Avro/Schema/NamedSchemata.php rename to lib/avro-php/Avro/Schema/NamedSchemata.php diff --git a/src/Avro/Schema/PrimitiveSchema.php b/lib/avro-php/Avro/Schema/PrimitiveSchema.php similarity index 100% rename from src/Avro/Schema/PrimitiveSchema.php rename to lib/avro-php/Avro/Schema/PrimitiveSchema.php diff --git a/src/Avro/Schema/RecordSchema.php b/lib/avro-php/Avro/Schema/RecordSchema.php similarity index 100% rename from src/Avro/Schema/RecordSchema.php rename to lib/avro-php/Avro/Schema/RecordSchema.php diff --git a/src/Avro/Schema/Schema.php b/lib/avro-php/Avro/Schema/Schema.php similarity index 100% rename from src/Avro/Schema/Schema.php rename to lib/avro-php/Avro/Schema/Schema.php diff --git a/src/Avro/Schema/UnionSchema.php b/lib/avro-php/Avro/Schema/UnionSchema.php similarity index 100% rename from src/Avro/Schema/UnionSchema.php rename to lib/avro-php/Avro/Schema/UnionSchema.php diff --git a/src/Avro/Util/Util.php b/lib/avro-php/Avro/Util/Util.php similarity index 100% rename from src/Avro/Util/Util.php rename to lib/avro-php/Avro/Util/Util.php diff --git a/src/AvroDeserializer.php b/src/AvroDeserializer.php index 7f3e38e..4a1f32c 100644 --- a/src/AvroDeserializer.php +++ b/src/AvroDeserializer.php @@ -3,6 +3,7 @@ use Avro\Datum; use Avro\IO; +use NYPL\Starter\AvroLoader; class AvroDeserializer { @@ -32,6 +33,8 @@ class AvroDeserializer protected static function initialize() { if (!self::isInitialized()) { + AvroLoader::load(); + self::setInitialized(true); } diff --git a/src/AvroLoader.php b/src/AvroLoader.php new file mode 100644 index 0000000..54b412e --- /dev/null +++ b/src/AvroLoader.php @@ -0,0 +1,35 @@ +write( json_decode(json_encode($this), true), self::getAvroEncoder() diff --git a/src/SchemaClient.php b/src/SchemaClient.php index 7c7f81c..c16dd8b 100644 --- a/src/SchemaClient.php +++ b/src/SchemaClient.php @@ -1,8 +1,8 @@ Date: Sat, 21 Dec 2024 13:05:00 -0500 Subject: [PATCH 39/57] Fixes avro dir. --- src/AvroLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AvroLoader.php b/src/AvroLoader.php index 54b412e..2809957 100644 --- a/src/AvroLoader.php +++ b/src/AvroLoader.php @@ -27,7 +27,7 @@ public static function setLoaded($loaded) public static function load() { if (!self::isLoaded()) { - require __DIR__ . '/../lib/avro-php/avro.php'; + require __DIR__ . '/../lib/avro-php/Avro/Avro.php'; self::setLoaded(true); } From 31301d2e43a3097b7e705dc028c1f34911370d5c Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 13:13:39 -0500 Subject: [PATCH 40/57] Adds lib to autoload dirs. --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ca193f3..a4e529d 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "autoload": { "psr-4": { "NYPL\\Starter\\": [ - "src/" + "src/", + "lib/" ] } } From dbc7cbb76d94acadfd73e77e633e5436671dfc42 Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 13:23:10 -0500 Subject: [PATCH 41/57] Moves avro dir --- lib/{avro-php => }/Avro/Avro.php | 0 lib/{avro-php => }/Avro/DataIO/DataIO.php | 0 lib/{avro-php => }/Avro/DataIO/DataIOReader.php | 0 lib/{avro-php => }/Avro/DataIO/DataIOWriter.php | 0 lib/{avro-php => }/Avro/Datum/IOBinaryDecoder.php | 0 lib/{avro-php => }/Avro/Datum/IOBinaryEncoder.php | 0 lib/{avro-php => }/Avro/Datum/IODatumReader.php | 0 lib/{avro-php => }/Avro/Datum/IODatumWriter.php | 0 lib/{avro-php => }/Avro/Debug/Debug.php | 0 lib/{avro-php => }/Avro/Exception/DataIoException.php | 0 lib/{avro-php => }/Avro/Exception/Exception.php | 0 lib/{avro-php => }/Avro/Exception/IOException.php | 0 lib/{avro-php => }/Avro/Exception/IOSchemaMatchException.php | 0 lib/{avro-php => }/Avro/Exception/IOTypeException.php | 0 lib/{avro-php => }/Avro/Exception/NotImplementedException.php | 0 lib/{avro-php => }/Avro/Exception/ProtocolParseException.php | 0 lib/{avro-php => }/Avro/Exception/SchemaParseException.php | 0 lib/{avro-php => }/Avro/GMP/GMP.php | 0 lib/{avro-php => }/Avro/IO/File.php | 0 lib/{avro-php => }/Avro/IO/IO.php | 0 lib/{avro-php => }/Avro/IO/StringIO.php | 0 lib/{avro-php => }/Avro/Protocol/Protocol.php | 0 lib/{avro-php => }/Avro/Protocol/ProtocolMessage.php | 0 lib/{avro-php => }/Avro/Schema/ArraySchema.php | 0 lib/{avro-php => }/Avro/Schema/EnumSchema.php | 0 lib/{avro-php => }/Avro/Schema/Field.php | 0 lib/{avro-php => }/Avro/Schema/FixedSchema.php | 0 lib/{avro-php => }/Avro/Schema/MapSchema.php | 0 lib/{avro-php => }/Avro/Schema/Name.php | 0 lib/{avro-php => }/Avro/Schema/NamedSchema.php | 0 lib/{avro-php => }/Avro/Schema/NamedSchemata.php | 0 lib/{avro-php => }/Avro/Schema/PrimitiveSchema.php | 0 lib/{avro-php => }/Avro/Schema/RecordSchema.php | 0 lib/{avro-php => }/Avro/Schema/Schema.php | 0 lib/{avro-php => }/Avro/Schema/UnionSchema.php | 0 lib/{avro-php => }/Avro/Util/Util.php | 0 src/AvroLoader.php | 2 +- 37 files changed, 1 insertion(+), 1 deletion(-) rename lib/{avro-php => }/Avro/Avro.php (100%) rename lib/{avro-php => }/Avro/DataIO/DataIO.php (100%) rename lib/{avro-php => }/Avro/DataIO/DataIOReader.php (100%) rename lib/{avro-php => }/Avro/DataIO/DataIOWriter.php (100%) rename lib/{avro-php => }/Avro/Datum/IOBinaryDecoder.php (100%) rename lib/{avro-php => }/Avro/Datum/IOBinaryEncoder.php (100%) rename lib/{avro-php => }/Avro/Datum/IODatumReader.php (100%) rename lib/{avro-php => }/Avro/Datum/IODatumWriter.php (100%) rename lib/{avro-php => }/Avro/Debug/Debug.php (100%) rename lib/{avro-php => }/Avro/Exception/DataIoException.php (100%) rename lib/{avro-php => }/Avro/Exception/Exception.php (100%) rename lib/{avro-php => }/Avro/Exception/IOException.php (100%) rename lib/{avro-php => }/Avro/Exception/IOSchemaMatchException.php (100%) rename lib/{avro-php => }/Avro/Exception/IOTypeException.php (100%) rename lib/{avro-php => }/Avro/Exception/NotImplementedException.php (100%) rename lib/{avro-php => }/Avro/Exception/ProtocolParseException.php (100%) rename lib/{avro-php => }/Avro/Exception/SchemaParseException.php (100%) rename lib/{avro-php => }/Avro/GMP/GMP.php (100%) rename lib/{avro-php => }/Avro/IO/File.php (100%) rename lib/{avro-php => }/Avro/IO/IO.php (100%) rename lib/{avro-php => }/Avro/IO/StringIO.php (100%) rename lib/{avro-php => }/Avro/Protocol/Protocol.php (100%) rename lib/{avro-php => }/Avro/Protocol/ProtocolMessage.php (100%) rename lib/{avro-php => }/Avro/Schema/ArraySchema.php (100%) rename lib/{avro-php => }/Avro/Schema/EnumSchema.php (100%) rename lib/{avro-php => }/Avro/Schema/Field.php (100%) rename lib/{avro-php => }/Avro/Schema/FixedSchema.php (100%) rename lib/{avro-php => }/Avro/Schema/MapSchema.php (100%) rename lib/{avro-php => }/Avro/Schema/Name.php (100%) rename lib/{avro-php => }/Avro/Schema/NamedSchema.php (100%) rename lib/{avro-php => }/Avro/Schema/NamedSchemata.php (100%) rename lib/{avro-php => }/Avro/Schema/PrimitiveSchema.php (100%) rename lib/{avro-php => }/Avro/Schema/RecordSchema.php (100%) rename lib/{avro-php => }/Avro/Schema/Schema.php (100%) rename lib/{avro-php => }/Avro/Schema/UnionSchema.php (100%) rename lib/{avro-php => }/Avro/Util/Util.php (100%) diff --git a/lib/avro-php/Avro/Avro.php b/lib/Avro/Avro.php similarity index 100% rename from lib/avro-php/Avro/Avro.php rename to lib/Avro/Avro.php diff --git a/lib/avro-php/Avro/DataIO/DataIO.php b/lib/Avro/DataIO/DataIO.php similarity index 100% rename from lib/avro-php/Avro/DataIO/DataIO.php rename to lib/Avro/DataIO/DataIO.php diff --git a/lib/avro-php/Avro/DataIO/DataIOReader.php b/lib/Avro/DataIO/DataIOReader.php similarity index 100% rename from lib/avro-php/Avro/DataIO/DataIOReader.php rename to lib/Avro/DataIO/DataIOReader.php diff --git a/lib/avro-php/Avro/DataIO/DataIOWriter.php b/lib/Avro/DataIO/DataIOWriter.php similarity index 100% rename from lib/avro-php/Avro/DataIO/DataIOWriter.php rename to lib/Avro/DataIO/DataIOWriter.php diff --git a/lib/avro-php/Avro/Datum/IOBinaryDecoder.php b/lib/Avro/Datum/IOBinaryDecoder.php similarity index 100% rename from lib/avro-php/Avro/Datum/IOBinaryDecoder.php rename to lib/Avro/Datum/IOBinaryDecoder.php diff --git a/lib/avro-php/Avro/Datum/IOBinaryEncoder.php b/lib/Avro/Datum/IOBinaryEncoder.php similarity index 100% rename from lib/avro-php/Avro/Datum/IOBinaryEncoder.php rename to lib/Avro/Datum/IOBinaryEncoder.php diff --git a/lib/avro-php/Avro/Datum/IODatumReader.php b/lib/Avro/Datum/IODatumReader.php similarity index 100% rename from lib/avro-php/Avro/Datum/IODatumReader.php rename to lib/Avro/Datum/IODatumReader.php diff --git a/lib/avro-php/Avro/Datum/IODatumWriter.php b/lib/Avro/Datum/IODatumWriter.php similarity index 100% rename from lib/avro-php/Avro/Datum/IODatumWriter.php rename to lib/Avro/Datum/IODatumWriter.php diff --git a/lib/avro-php/Avro/Debug/Debug.php b/lib/Avro/Debug/Debug.php similarity index 100% rename from lib/avro-php/Avro/Debug/Debug.php rename to lib/Avro/Debug/Debug.php diff --git a/lib/avro-php/Avro/Exception/DataIoException.php b/lib/Avro/Exception/DataIoException.php similarity index 100% rename from lib/avro-php/Avro/Exception/DataIoException.php rename to lib/Avro/Exception/DataIoException.php diff --git a/lib/avro-php/Avro/Exception/Exception.php b/lib/Avro/Exception/Exception.php similarity index 100% rename from lib/avro-php/Avro/Exception/Exception.php rename to lib/Avro/Exception/Exception.php diff --git a/lib/avro-php/Avro/Exception/IOException.php b/lib/Avro/Exception/IOException.php similarity index 100% rename from lib/avro-php/Avro/Exception/IOException.php rename to lib/Avro/Exception/IOException.php diff --git a/lib/avro-php/Avro/Exception/IOSchemaMatchException.php b/lib/Avro/Exception/IOSchemaMatchException.php similarity index 100% rename from lib/avro-php/Avro/Exception/IOSchemaMatchException.php rename to lib/Avro/Exception/IOSchemaMatchException.php diff --git a/lib/avro-php/Avro/Exception/IOTypeException.php b/lib/Avro/Exception/IOTypeException.php similarity index 100% rename from lib/avro-php/Avro/Exception/IOTypeException.php rename to lib/Avro/Exception/IOTypeException.php diff --git a/lib/avro-php/Avro/Exception/NotImplementedException.php b/lib/Avro/Exception/NotImplementedException.php similarity index 100% rename from lib/avro-php/Avro/Exception/NotImplementedException.php rename to lib/Avro/Exception/NotImplementedException.php diff --git a/lib/avro-php/Avro/Exception/ProtocolParseException.php b/lib/Avro/Exception/ProtocolParseException.php similarity index 100% rename from lib/avro-php/Avro/Exception/ProtocolParseException.php rename to lib/Avro/Exception/ProtocolParseException.php diff --git a/lib/avro-php/Avro/Exception/SchemaParseException.php b/lib/Avro/Exception/SchemaParseException.php similarity index 100% rename from lib/avro-php/Avro/Exception/SchemaParseException.php rename to lib/Avro/Exception/SchemaParseException.php diff --git a/lib/avro-php/Avro/GMP/GMP.php b/lib/Avro/GMP/GMP.php similarity index 100% rename from lib/avro-php/Avro/GMP/GMP.php rename to lib/Avro/GMP/GMP.php diff --git a/lib/avro-php/Avro/IO/File.php b/lib/Avro/IO/File.php similarity index 100% rename from lib/avro-php/Avro/IO/File.php rename to lib/Avro/IO/File.php diff --git a/lib/avro-php/Avro/IO/IO.php b/lib/Avro/IO/IO.php similarity index 100% rename from lib/avro-php/Avro/IO/IO.php rename to lib/Avro/IO/IO.php diff --git a/lib/avro-php/Avro/IO/StringIO.php b/lib/Avro/IO/StringIO.php similarity index 100% rename from lib/avro-php/Avro/IO/StringIO.php rename to lib/Avro/IO/StringIO.php diff --git a/lib/avro-php/Avro/Protocol/Protocol.php b/lib/Avro/Protocol/Protocol.php similarity index 100% rename from lib/avro-php/Avro/Protocol/Protocol.php rename to lib/Avro/Protocol/Protocol.php diff --git a/lib/avro-php/Avro/Protocol/ProtocolMessage.php b/lib/Avro/Protocol/ProtocolMessage.php similarity index 100% rename from lib/avro-php/Avro/Protocol/ProtocolMessage.php rename to lib/Avro/Protocol/ProtocolMessage.php diff --git a/lib/avro-php/Avro/Schema/ArraySchema.php b/lib/Avro/Schema/ArraySchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/ArraySchema.php rename to lib/Avro/Schema/ArraySchema.php diff --git a/lib/avro-php/Avro/Schema/EnumSchema.php b/lib/Avro/Schema/EnumSchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/EnumSchema.php rename to lib/Avro/Schema/EnumSchema.php diff --git a/lib/avro-php/Avro/Schema/Field.php b/lib/Avro/Schema/Field.php similarity index 100% rename from lib/avro-php/Avro/Schema/Field.php rename to lib/Avro/Schema/Field.php diff --git a/lib/avro-php/Avro/Schema/FixedSchema.php b/lib/Avro/Schema/FixedSchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/FixedSchema.php rename to lib/Avro/Schema/FixedSchema.php diff --git a/lib/avro-php/Avro/Schema/MapSchema.php b/lib/Avro/Schema/MapSchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/MapSchema.php rename to lib/Avro/Schema/MapSchema.php diff --git a/lib/avro-php/Avro/Schema/Name.php b/lib/Avro/Schema/Name.php similarity index 100% rename from lib/avro-php/Avro/Schema/Name.php rename to lib/Avro/Schema/Name.php diff --git a/lib/avro-php/Avro/Schema/NamedSchema.php b/lib/Avro/Schema/NamedSchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/NamedSchema.php rename to lib/Avro/Schema/NamedSchema.php diff --git a/lib/avro-php/Avro/Schema/NamedSchemata.php b/lib/Avro/Schema/NamedSchemata.php similarity index 100% rename from lib/avro-php/Avro/Schema/NamedSchemata.php rename to lib/Avro/Schema/NamedSchemata.php diff --git a/lib/avro-php/Avro/Schema/PrimitiveSchema.php b/lib/Avro/Schema/PrimitiveSchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/PrimitiveSchema.php rename to lib/Avro/Schema/PrimitiveSchema.php diff --git a/lib/avro-php/Avro/Schema/RecordSchema.php b/lib/Avro/Schema/RecordSchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/RecordSchema.php rename to lib/Avro/Schema/RecordSchema.php diff --git a/lib/avro-php/Avro/Schema/Schema.php b/lib/Avro/Schema/Schema.php similarity index 100% rename from lib/avro-php/Avro/Schema/Schema.php rename to lib/Avro/Schema/Schema.php diff --git a/lib/avro-php/Avro/Schema/UnionSchema.php b/lib/Avro/Schema/UnionSchema.php similarity index 100% rename from lib/avro-php/Avro/Schema/UnionSchema.php rename to lib/Avro/Schema/UnionSchema.php diff --git a/lib/avro-php/Avro/Util/Util.php b/lib/Avro/Util/Util.php similarity index 100% rename from lib/avro-php/Avro/Util/Util.php rename to lib/Avro/Util/Util.php diff --git a/src/AvroLoader.php b/src/AvroLoader.php index 2809957..9d7ee9d 100644 --- a/src/AvroLoader.php +++ b/src/AvroLoader.php @@ -27,7 +27,7 @@ public static function setLoaded($loaded) public static function load() { if (!self::isLoaded()) { - require __DIR__ . '/../lib/avro-php/Avro/Avro.php'; + require __DIR__ . '/../lib/Avro/Avro.php'; self::setLoaded(true); } From 54bdf76b9777894a2ea46e2a67fb60bf6df1a3fd Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 13:30:56 -0500 Subject: [PATCH 42/57] Adds avro to autoload --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a4e529d..c64eec5 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,9 @@ "autoload": { "psr-4": { "NYPL\\Starter\\": [ - "src/", + "src/" + ], + "Avro": [ "lib/" ] } From 9bca693b2299bd828ab94dee2656ef5a1a791174 Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 13:33:39 -0500 Subject: [PATCH 43/57] Adds separator --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c64eec5..4db545e 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "NYPL\\Starter\\": [ "src/" ], - "Avro": [ + "Avro\\": [ "lib/" ] } From 98ceebcf49e9ab3cbcb61bcefa5b6b1b6a5c11a4 Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 15:49:19 -0500 Subject: [PATCH 44/57] Updates autoload method for Avro. --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 4db545e..5320d97 100644 --- a/composer.json +++ b/composer.json @@ -19,12 +19,12 @@ "aura/di": "4.*" }, "autoload": { + "psr-0": { + "": "lib/" + }, "psr-4": { "NYPL\\Starter\\": [ "src/" - ], - "Avro\\": [ - "lib/" ] } } From 0868c209e7f1146d0a27f567ed325c809fcfb03c Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 16:02:49 -0500 Subject: [PATCH 45/57] Applied patch to Avro. --- lib/Avro/Datum/IODatumWriter.php | 10 +++++++--- lib/Avro/IO/StringIO.php | 5 +++-- lib/Avro/Schema/Schema.php | 5 +++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/Avro/Datum/IODatumWriter.php b/lib/Avro/Datum/IODatumWriter.php index c868909..5bce3b9 100644 --- a/lib/Avro/Datum/IODatumWriter.php +++ b/lib/Avro/Datum/IODatumWriter.php @@ -153,9 +153,13 @@ private function write_fixed(Schema $writers_schema, $datum, IOBinaryEncoder $en private function write_record(Schema $writers_schema, $datum, IOBinaryEncoder $encoder) { - foreach ($writers_schema->fields() as $field) - $this->write_data($field->type(), $datum[$field->name()], $encoder); + // Patched to supply default value. + foreach ($writers_schema->fields() as $field) { + /* Patched to supply a default value with a field isn't set. */ + $value = isset($datum[$field->name()]) ? $datum[$field->name()] : $field->default_value(); + $this->write_data($field->type(), $value, $encoder); + } } /**#@-*/ -} \ No newline at end of file +} diff --git a/lib/Avro/IO/StringIO.php b/lib/Avro/IO/StringIO.php index 0158f7d..91b1475 100644 --- a/lib/Avro/IO/StringIO.php +++ b/lib/Avro/IO/StringIO.php @@ -53,7 +53,8 @@ public function __construct($str = '') public function write($arg) { $this->check_closed(); - if (is_string($arg)) + // Patched to allow integers. + if (is_string($arg) || is_int($arg)) return $this->append_str($arg); throw new IOException( sprintf('write argument must be a string: (%s) %s', @@ -221,4 +222,4 @@ public function is_closed() { return $this->is_closed; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/Schema.php b/lib/Avro/Schema/Schema.php index b384f6b..d3bf428 100644 --- a/lib/Avro/Schema/Schema.php +++ b/lib/Avro/Schema/Schema.php @@ -368,8 +368,9 @@ public static function is_valid_datum($expected_schema, $datum) case self::MAP_SCHEMA: if (is_array($datum)) { + // Patched to allow integers. foreach ($datum as $k => $v) - if (!is_string($k) + if ((!is_string($k) && !is_int($k)) || !self::is_valid_datum($expected_schema->values(), $v)) return false; return true; @@ -462,4 +463,4 @@ public function __toString() { return json_encode($this->to_avro()); } */ public function attribute($attribute) { return $this->$attribute(); } -} \ No newline at end of file +} From bf6306ee5d7a1a46ada11372da69fd2f74753a99 Mon Sep 17 00:00:00 2001 From: John Berube Date: Sat, 21 Dec 2024 16:09:03 -0500 Subject: [PATCH 46/57] Removes unnecessary Avroloader class.. --- lib/Avro/README.md | 1 + src/AvroDeserializer.php | 3 --- src/AvroLoader.php | 35 --------------------------- src/Model/ModelTrait/MessageTrait.php | 3 --- src/SchemaClient.php | 2 -- 5 files changed, 1 insertion(+), 43 deletions(-) create mode 100644 lib/Avro/README.md delete mode 100644 src/AvroLoader.php diff --git a/lib/Avro/README.md b/lib/Avro/README.md new file mode 100644 index 0000000..706354f --- /dev/null +++ b/lib/Avro/README.md @@ -0,0 +1 @@ +This is a fork of https://github.com/nealio82/avro-php. Changes were made to allow schema arrays to have integer keys. diff --git a/src/AvroDeserializer.php b/src/AvroDeserializer.php index 4a1f32c..7f3e38e 100644 --- a/src/AvroDeserializer.php +++ b/src/AvroDeserializer.php @@ -3,7 +3,6 @@ use Avro\Datum; use Avro\IO; -use NYPL\Starter\AvroLoader; class AvroDeserializer { @@ -33,8 +32,6 @@ class AvroDeserializer protected static function initialize() { if (!self::isInitialized()) { - AvroLoader::load(); - self::setInitialized(true); } diff --git a/src/AvroLoader.php b/src/AvroLoader.php deleted file mode 100644 index 9d7ee9d..0000000 --- a/src/AvroLoader.php +++ /dev/null @@ -1,35 +0,0 @@ -write( json_decode(json_encode($this), true), self::getAvroEncoder() diff --git a/src/SchemaClient.php b/src/SchemaClient.php index c16dd8b..0d1177c 100644 --- a/src/SchemaClient.php +++ b/src/SchemaClient.php @@ -61,8 +61,6 @@ protected static function getSchemaResponse($schemaName = '') */ public static function getSchema($schemaName = '') { - AvroLoader::load(); - $cacheKey = self::BASE_CACHE_KEY . 'Schema:' . $schemaName; if ($schema = AppCache::get($cacheKey)) { From 8e30e825615953cd6642b9c75256378940e7a9ef Mon Sep 17 00:00:00 2001 From: John Berube Date: Mon, 23 Dec 2024 09:00:21 -0500 Subject: [PATCH 47/57] Updates versions in composer.json. --- composer.json | 12 ++++++------ composer.lock | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 5320d97..c652b42 100644 --- a/composer.json +++ b/composer.json @@ -9,14 +9,14 @@ ], "require": { "slim/slim": "^4.14.0", - "faapz/pdo": "^2.2.0", - "monolog/monolog": "^3.7.0", - "danielstjules/stringy": "^3.1", - "zircote/swagger-php": "^4.10.6", - "aws/aws-sdk-php": "^3.319.4", + "faapz/pdo": "^2.2.1", + "monolog/monolog": "^3.8.1", + "danielstjules/stringy": "^3.1.0", + "zircote/swagger-php": "^4.11.1", + "aws/aws-sdk-php": "^3.336.2", "vlucas/phpdotenv": "^5.6.1", "guzzlehttp/guzzle": "^7.9.2", - "aura/di": "4.*" + "aura/di": "^4.2.1" }, "autoload": { "psr-0": { diff --git a/composer.lock b/composer.lock index 2323402..4ed3c71 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "07c15a35d1388f718a76e40ce00763b3", + "content-hash": "732386b7b085da68cc98a33df8d9db03", "packages": [ { "name": "aura/di", From 98afa8ca00351b1906f9b0e64591e7b8d6d5fe3a Mon Sep 17 00:00:00 2001 From: John Berube Date: Mon, 23 Dec 2024 09:27:55 -0500 Subject: [PATCH 48/57] Checks for method before executing. --- src/Model/ModelTrait/DBReadTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/ModelTrait/DBReadTrait.php b/src/Model/ModelTrait/DBReadTrait.php index a70a27d..1edf78c 100644 --- a/src/Model/ModelTrait/DBReadTrait.php +++ b/src/Model/ModelTrait/DBReadTrait.php @@ -289,7 +289,7 @@ protected function applyWhere(Filter $filter, StatementInterface $selectStatemen $filter->getFilterValue() ); - if ($existingWhere = $selectStatement->getWhere()) { + if (method_exists($selectStatement, 'getWhere') && $existingWhere = $selectStatement->getWhere()) { $grouping = new Grouping('AND', $conditional, $existingWhere); } else { $grouping = $conditional; From cafc55b4a25395c9aa91de7f91608afc1dfe421d Mon Sep 17 00:00:00 2001 From: John Berube Date: Mon, 23 Dec 2024 09:49:28 -0500 Subject: [PATCH 49/57] Adds class for ExtendedUpdateStatement to match ExtendedSelectStatement. --- src/Slim/ExtendedDatabase.php | 11 +++++++- src/Slim/ExtendedUpdateStatement.php | 42 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/Slim/ExtendedUpdateStatement.php diff --git a/src/Slim/ExtendedDatabase.php b/src/Slim/ExtendedDatabase.php index cc843c3..f4dc551 100644 --- a/src/Slim/ExtendedDatabase.php +++ b/src/Slim/ExtendedDatabase.php @@ -2,8 +2,8 @@ namespace NYPL\Starter\Slim; use FaaPz\PDO\Database; -use FaaPz\PDO\Statement\Select; use FaaPz\PDO\Statement\SelectInterface; +use FaaPz\PDO\Statement\UpdateInterface; class ExtendedDatabase extends Database { @@ -17,4 +17,13 @@ public function select(array $columns = ['*']): SelectInterface return new ExtendedSelectStatement($this, $columns); } + /** + * @param array $pairs + * + * @return UpdateInterface + */ + public function update(array $pairs = []): UpdateInterface + { + return new ExtendedUpdateStatement($this, $pairs); + } } diff --git a/src/Slim/ExtendedUpdateStatement.php b/src/Slim/ExtendedUpdateStatement.php new file mode 100644 index 0000000..2eba044 --- /dev/null +++ b/src/Slim/ExtendedUpdateStatement.php @@ -0,0 +1,42 @@ + $pairs + */ + public function __construct(Database $dbh, array $pairs = []) + { + parent::__construct($dbh, $pairs); + + $this->whereClause = new ExtendedWhereClause(); + } + + public function addParenthesis() + { + $this->whereClause->addParenthesis(); + } + + public function closeParenthesis() + { + $this->whereClause->closeParenthesis(); + } + + public function getWhere() { + return $this->where; + } + +} From 30e67690dc121b123b2e990832420e972b6c502c Mon Sep 17 00:00:00 2001 From: John Berube Date: Mon, 30 Dec 2024 14:17:07 -0500 Subject: [PATCH 50/57] Adds #[\AllowDynamicProperties] to classes to suppress depecated warning. --- lib/Avro/Schema/ArraySchema.php | 3 ++- lib/Avro/Schema/EnumSchema.php | 3 ++- lib/Avro/Schema/Field.php | 3 ++- lib/Avro/Schema/FixedSchema.php | 3 ++- lib/Avro/Schema/MapSchema.php | 3 ++- lib/Avro/Schema/Name.php | 3 ++- lib/Avro/Schema/NamedSchema.php | 3 ++- lib/Avro/Schema/NamedSchemata.php | 3 ++- lib/Avro/Schema/PrimitiveSchema.php | 3 ++- lib/Avro/Schema/RecordSchema.php | 3 ++- lib/Avro/Schema/Schema.php | 5 +++++ lib/Avro/Schema/UnionSchema.php | 3 ++- 12 files changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/Avro/Schema/ArraySchema.php b/lib/Avro/Schema/ArraySchema.php index 3ab8629..a8e3c12 100644 --- a/lib/Avro/Schema/ArraySchema.php +++ b/lib/Avro/Schema/ArraySchema.php @@ -7,6 +7,7 @@ * Avro schema type. * @package Avro */ +#[\AllowDynamicProperties] class ArraySchema extends Schema { /** @@ -64,4 +65,4 @@ public function to_avro() ? $this->items->qualified_name() : $this->items->to_avro(); return $avro; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/EnumSchema.php b/lib/Avro/Schema/EnumSchema.php index ead9929..8c33887 100644 --- a/lib/Avro/Schema/EnumSchema.php +++ b/lib/Avro/Schema/EnumSchema.php @@ -9,6 +9,7 @@ /** * @package Avro */ +#[\AllowDynamicProperties] class EnumSchema extends NamedSchema { /** @@ -92,4 +93,4 @@ public function to_avro() $avro[Schema::SYMBOLS_ATTR] = $this->symbols; return $avro; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/Field.php b/lib/Avro/Schema/Field.php index ad5f9c6..733d8b8 100644 --- a/lib/Avro/Schema/Field.php +++ b/lib/Avro/Schema/Field.php @@ -8,6 +8,7 @@ * Field of an {@link RecordSchema} * @package Avro */ +#[\AllowDynamicProperties] class Field extends Schema { @@ -164,4 +165,4 @@ public function has_default_value() { return $this->has_default; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/FixedSchema.php b/lib/Avro/Schema/FixedSchema.php index 4c68a17..627973d 100644 --- a/lib/Avro/Schema/FixedSchema.php +++ b/lib/Avro/Schema/FixedSchema.php @@ -8,6 +8,7 @@ * NamedSchema with fixed-length data values * @package Avro */ +#[\AllowDynamicProperties] class FixedSchema extends NamedSchema { @@ -50,4 +51,4 @@ public function to_avro() $avro[Schema::SIZE_ATTR] = $this->size; return $avro; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/MapSchema.php b/lib/Avro/Schema/MapSchema.php index b1643b3..473e10d 100644 --- a/lib/Avro/Schema/MapSchema.php +++ b/lib/Avro/Schema/MapSchema.php @@ -7,6 +7,7 @@ * Avro Schema types. * @package Avro */ +#[\AllowDynamicProperties] class MapSchema extends Schema { /** @@ -63,4 +64,4 @@ public function to_avro() ? $this->values->qualified_name() : $this->values->to_avro(); return $avro; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/Name.php b/lib/Avro/Schema/Name.php index f3910c1..03bb6eb 100644 --- a/lib/Avro/Schema/Name.php +++ b/lib/Avro/Schema/Name.php @@ -7,6 +7,7 @@ /** * @package Avro */ +#[\AllowDynamicProperties] class Name { /** @@ -155,4 +156,4 @@ public function qualified_name() return $this->qualified_name; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/NamedSchema.php b/lib/Avro/Schema/NamedSchema.php index 31911f2..6c45cdf 100644 --- a/lib/Avro/Schema/NamedSchema.php +++ b/lib/Avro/Schema/NamedSchema.php @@ -10,6 +10,7 @@ * @todo Refactor NamedSchema to use an AvroName instance * to store name information. */ +#[\AllowDynamicProperties] class NamedSchema extends Schema { /** @@ -70,4 +71,4 @@ public function qualified_name() return $this->name->qualified_name(); } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/NamedSchemata.php b/lib/Avro/Schema/NamedSchemata.php index f9827fb..cc04b9b 100644 --- a/lib/Avro/Schema/NamedSchemata.php +++ b/lib/Avro/Schema/NamedSchemata.php @@ -10,6 +10,7 @@ * * @package Avro */ +#[\AllowDynamicProperties] class NamedSchemata { /** @@ -83,4 +84,4 @@ public function clone_with_new_schema(NamedSchema $schema) $schemata->schemata[$name] = $schema; return $schemata; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/PrimitiveSchema.php b/lib/Avro/Schema/PrimitiveSchema.php index af5cbf7..c5cbeb3 100644 --- a/lib/Avro/Schema/PrimitiveSchema.php +++ b/lib/Avro/Schema/PrimitiveSchema.php @@ -8,6 +8,7 @@ * Avro schema for basic types such as null, int, long, string. * @package Avro */ +#[\AllowDynamicProperties] class PrimitiveSchema extends Schema { @@ -35,4 +36,4 @@ public function to_avro() return $this->type; return $avro; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/RecordSchema.php b/lib/Avro/Schema/RecordSchema.php index 2687c2d..3149a94 100644 --- a/lib/Avro/Schema/RecordSchema.php +++ b/lib/Avro/Schema/RecordSchema.php @@ -8,6 +8,7 @@ /** * @package Avro */ +#[\AllowDynamicProperties] class RecordSchema extends NamedSchema { /** @@ -135,4 +136,4 @@ public function fields_hash() } return $this->fields_hash; } -} \ No newline at end of file +} diff --git a/lib/Avro/Schema/Schema.php b/lib/Avro/Schema/Schema.php index d3bf428..68fa40f 100644 --- a/lib/Avro/Schema/Schema.php +++ b/lib/Avro/Schema/Schema.php @@ -5,6 +5,11 @@ use Avro\Exception\SchemaParseException; use Avro\Util\Util; +/** + * Avro schema. + * @package Avro + */ +#[\AllowDynamicProperties] class Schema { /** diff --git a/lib/Avro/Schema/UnionSchema.php b/lib/Avro/Schema/UnionSchema.php index 1efcfd4..6da44ac 100644 --- a/lib/Avro/Schema/UnionSchema.php +++ b/lib/Avro/Schema/UnionSchema.php @@ -9,6 +9,7 @@ * the union. * @package Avro */ +#[\AllowDynamicProperties] class UnionSchema extends Schema { /** @@ -97,4 +98,4 @@ public function to_avro() return $avro; } -} \ No newline at end of file +} From 56ac171b265159948e0fc22b1639b886e1fcab44 Mon Sep 17 00:00:00 2001 From: John Berube Date: Mon, 30 Dec 2024 14:17:57 -0500 Subject: [PATCH 51/57] Replaces stringy library with one compatible with php 8. --- composer.json | 2 +- composer.lock | 1676 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 1545 insertions(+), 133 deletions(-) diff --git a/composer.json b/composer.json index c652b42..1d9f3ef 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "slim/slim": "^4.14.0", "faapz/pdo": "^2.2.1", "monolog/monolog": "^3.8.1", - "danielstjules/stringy": "^3.1.0", + "voku/stringy": "^6.5.3", "zircote/swagger-php": "^4.11.1", "aws/aws-sdk-php": "^3.336.2", "vlucas/phpdotenv": "^5.6.1", diff --git a/composer.lock b/composer.lock index 4ed3c71..9963761 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "732386b7b085da68cc98a33df8d9db03", + "content-hash": "8768f7177e321556c3fc1f9141c886ae", "packages": [ { "name": "aura/di", @@ -119,16 +119,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.336.2", + "version": "3.336.6", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4" + "reference": "0a99dab427f0a1c082775301141aeac3558691ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/954bfdfc048840ca34afe2a2e1cbcff6681989c4", - "reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0a99dab427f0a1c082775301141aeac3558691ad", + "reference": "0a99dab427f0a1c082775301141aeac3558691ad", "shasum": "" }, "require": { @@ -211,38 +211,40 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.336.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.336.6" }, - "time": "2024-12-20T19:05:10+00:00" + "time": "2024-12-28T04:16:13+00:00" }, { - "name": "danielstjules/stringy", - "version": "3.1.0", + "name": "defuse/php-encryption", + "version": "v2.4.0", "source": { "type": "git", - "url": "https://github.com/danielstjules/Stringy.git", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" + "url": "https://github.com/defuse/php-encryption.git", + "reference": "f53396c2d34225064647a05ca76c1da9d99e5828" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "url": "https://api.github.com/repos/defuse/php-encryption/zipball/f53396c2d34225064647a05ca76c1da9d99e5828", + "reference": "f53396c2d34225064647a05ca76c1da9d99e5828", "shasum": "" }, "require": { - "php": ">=5.4.0", - "symfony/polyfill-mbstring": "~1.1" + "ext-openssl": "*", + "paragonie/random_compat": ">= 2", + "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^5|^6|^7|^8|^9|^10", + "yoast/phpunit-polyfills": "^2.0.0" }, + "bin": [ + "bin/generate-defuse-key" + ], "type": "library", "autoload": { - "files": [ - "src/Create.php" - ], "psr-4": { - "Stringy\\": "src/" + "Defuse\\Crypto\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -251,29 +253,79 @@ ], "authors": [ { - "name": "Daniel St. Jules", - "email": "danielst.jules@gmail.com", - "homepage": "http://www.danielstjules.com" + "name": "Taylor Hornby", + "email": "taylor@defuse.ca", + "homepage": "https://defuse.ca/" + }, + { + "name": "Scott Arciszewski", + "email": "info@paragonie.com", + "homepage": "https://paragonie.com" } ], - "description": "A string manipulation library with multibyte support", - "homepage": "https://github.com/danielstjules/Stringy", + "description": "Secure PHP Encryption Library", "keywords": [ - "UTF", - "helpers", - "manipulation", - "methods", - "multibyte", - "string", - "utf-8", - "utility", - "utils" + "aes", + "authenticated encryption", + "cipher", + "crypto", + "cryptography", + "encrypt", + "encryption", + "openssl", + "security", + "symmetric key cryptography" + ], + "support": { + "issues": "https://github.com/defuse/php-encryption/issues", + "source": "https://github.com/defuse/php-encryption/tree/v2.4.0" + }, + "time": "2023-06-19T06:10:36+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9", + "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^12", + "phpstan/phpstan": "1.4.10 || 2.0.3", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/log": "^1 || ^2 || ^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", "support": { - "issues": "https://github.com/danielstjules/Stringy/issues", - "source": "https://github.com/danielstjules/Stringy" + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.4" }, - "time": "2017-06-12T01:10:27+00:00" + "time": "2024-12-07T21:18:45+00:00" }, { "name": "faapz/pdo", @@ -942,6 +994,231 @@ }, "time": "2018-02-13T20:26:39+00:00" }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", + "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.1", + "ext-filter": "*", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.7", + "phpstan/phpdoc-parser": "^1.7|^2.0", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.5 || ~1.6.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^5.26" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1" + }, + "time": "2024-12-07T09:39:29+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a", + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.3 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.18|^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.10.0" + }, + "time": "2024-11-09T15:12:26+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.3", @@ -1017,6 +1294,53 @@ ], "time": "2024-07-20T21:41:07+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/c00d78fb6b29658347f9d37ebe104bffadf36299", + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^5.3.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.0.0" + }, + "time": "2024-10-13T11:29:49+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -1572,12 +1896,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -1764,27 +2088,27 @@ "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-mbstring", + "name": "symfony/polyfill-iconv", "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "url": "https://github.com/symfony/polyfill-iconv.git", + "reference": "48becf00c920479ca2e910c22a5a39e5d47ca956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/48becf00c920479ca2e910c22a5a39e5d47ca956", + "reference": "48becf00c920479ca2e910c22a5a39e5d47ca956", "shasum": "" }, "require": { "php": ">=7.2" }, "provide": { - "ext-mbstring": "*" + "ext-iconv": "*" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-iconv": "For best performance" }, "type": "library", "extra": { @@ -1798,7 +2122,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Iconv\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1815,17 +2139,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for the Iconv extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "iconv", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.31.0" }, "funding": [ { @@ -1844,22 +2168,25 @@ "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-php80", + "name": "symfony/polyfill-intl-grapheme", "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { "php": ">=7.2" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "thanks": { @@ -1872,21 +2199,14 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -1896,16 +2216,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "grapheme", + "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" }, "funding": [ { @@ -1924,40 +2246,124 @@ "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/yaml", - "version": "v7.2.0", + "name": "symfony/polyfill-intl-idn", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "099581e99f557e9f16b43c5916c26380b54abb22" + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/099581e99f557e9f16b43c5916c26380b54abb22", - "reference": "099581e99f557e9f16b43c5916c26380b54abb22", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773", + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "^1.8" + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" }, - "conflict": { - "symfony/console": "<6.4" + "suggest": { + "ext-intl": "For best performance" }, - "require-dev": { - "symfony/console": "^6.4|^7.0" + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } }, - "bin": [ - "Resources/bin/yaml-lint" + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1966,18 +2372,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Loads and dumps YAML files", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], "support": { - "source": "https://github.com/symfony/yaml/tree/v7.2.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" }, "funding": [ { @@ -1993,91 +2407,1089 @@ "type": "tidelift" } ], - "time": "2024-10-23T06:56:12+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "vlucas/phpdotenv", - "version": "v5.6.1", + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", - "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.3", - "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.3", - "symfony/polyfill-ctype": "^1.24", - "symfony/polyfill-mbstring": "^1.24", - "symfony/polyfill-php80": "^1.24" + "php": ">=7.2" }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "ext-filter": "*", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "provide": { + "ext-mbstring": "*" }, "suggest": { - "ext-filter": "Required to use the boolean validator." + "ext-mbstring": "For best performance" }, "type": "library", "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "5.6-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Dotenv\\": "src/" + "Symfony\\Polyfill\\Mbstring\\": "" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", "keywords": [ - "dotenv", - "env", - "environment" + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" ], "support": { - "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { - "url": "https://github.com/GrahamCampbell", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-07-20T21:52:34+00:00" + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "metapackage", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/yaml", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "099581e99f557e9f16b43c5916c26380b54abb22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/099581e99f557e9f16b43c5916c26380b54abb22", + "reference": "099581e99f557e9f16b43c5916c26380b54abb22", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "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": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-23T06:56:12+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.6.1", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.3", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3", + "symfony/polyfill-ctype": "^1.24", + "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php80": "^1.24" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-filter": "*", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:52:34+00:00" + }, + { + "name": "voku/anti-xss", + "version": "4.1.42", + "source": { + "type": "git", + "url": "https://github.com/voku/anti-xss.git", + "reference": "bca1f8607e55a3c5077483615cd93bd8f11bd675" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/anti-xss/zipball/bca1f8607e55a3c5077483615cd93bd8f11bd675", + "reference": "bca1f8607e55a3c5077483615cd93bd8f11bd675", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "voku/portable-utf8": "~6.0.2" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "voku\\helper\\": "src/voku/helper/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "EllisLab Dev Team", + "homepage": "http://ellislab.com/" + }, + { + "name": "Lars Moelleken", + "email": "lars@moelleken.org", + "homepage": "https://www.moelleken.org/" + } + ], + "description": "anti xss-library", + "homepage": "https://github.com/voku/anti-xss", + "keywords": [ + "anti-xss", + "clean", + "security", + "xss" + ], + "support": { + "issues": "https://github.com/voku/anti-xss/issues", + "source": "https://github.com/voku/anti-xss/tree/4.1.42" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/anti-xss", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/anti-xss", + "type": "tidelift" + } + ], + "time": "2023-07-03T14:40:46+00:00" + }, + { + "name": "voku/arrayy", + "version": "7.9.6", + "source": { + "type": "git", + "url": "https://github.com/voku/Arrayy.git", + "reference": "0e20b8c6eef7fc46694a2906e0eae2f9fc11cade" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/Arrayy/zipball/0e20b8c6eef7fc46694a2906e0eae2f9fc11cade", + "reference": "0e20b8c6eef7fc46694a2906e0eae2f9fc11cade", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.0.0", + "phpdocumentor/reflection-docblock": "~4.3 || ~5.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Create.php" + ], + "psr-4": { + "Arrayy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "email": "lars@moelleken.org", + "homepage": "https://www.moelleken.org/", + "role": "Maintainer" + } + ], + "description": "Array manipulation library for PHP, called Arrayy!", + "keywords": [ + "Arrayy", + "array", + "helpers", + "manipulation", + "methods", + "utility", + "utils" + ], + "support": { + "docs": "https://voku.github.io/Arrayy/", + "issues": "https://github.com/voku/Arrayy/issues", + "source": "https://github.com/voku/Arrayy" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/arrayy", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/arrayy", + "type": "tidelift" + } + ], + "time": "2022-12-27T12:58:32+00:00" + }, + { + "name": "voku/email-check", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/voku/email-check.git", + "reference": "6ea842920bbef6758b8c1e619fd1710e7a1a2cac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/email-check/zipball/6ea842920bbef6758b8c1e619fd1710e7a1a2cac", + "reference": "6ea842920bbef6758b8c1e619fd1710e7a1a2cac", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "symfony/polyfill-intl-idn": "~1.10" + }, + "require-dev": { + "fzaninotto/faker": "~1.7", + "phpunit/phpunit": "~6.0 || ~7.0" + }, + "suggest": { + "ext-intl": "Use Intl for best performance" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\helper\\": "src/voku/helper/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "email-check (syntax, dns, trash, ...) library", + "homepage": "https://github.com/voku/email-check", + "keywords": [ + "check-email", + "email", + "mail", + "mail-check", + "validate-email", + "validate-email-address", + "validate-mail" + ], + "support": { + "issues": "https://github.com/voku/email-check/issues", + "source": "https://github.com/voku/email-check/tree/3.1.0" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/email-check", + "type": "tidelift" + } + ], + "time": "2021-01-27T14:14:33+00:00" + }, + { + "name": "voku/portable-ascii", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "b1d923f88091c6bf09699efcd7c8a1b1bfd7351d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/b1d923f88091c6bf09699efcd7c8a1b1bfd7351d", + "reference": "b1d923f88091c6bf09699efcd7c8a1b1bfd7351d", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "https://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ], + "support": { + "issues": "https://github.com/voku/portable-ascii/issues", + "source": "https://github.com/voku/portable-ascii/tree/2.0.3" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-ascii", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii", + "type": "tidelift" + } + ], + "time": "2024-11-21T01:49:47+00:00" + }, + { + "name": "voku/portable-utf8", + "version": "6.0.13", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-utf8.git", + "reference": "b8ce36bf26593e5c2e81b1850ef0ffb299d2043f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-utf8/zipball/b8ce36bf26593e5c2e81b1850ef0ffb299d2043f", + "reference": "b8ce36bf26593e5c2e81b1850ef0ffb299d2043f", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "symfony/polyfill-iconv": "~1.0", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.0", + "voku/portable-ascii": "~2.0.0" + }, + "require-dev": { + "phpstan/phpstan": "1.9.*@dev", + "phpstan/phpstan-strict-rules": "1.4.*@dev", + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0", + "thecodingmachine/phpstan-strict-rules": "1.0.*@dev", + "voku/phpstan-rules": "3.1.*@dev" + }, + "suggest": { + "ext-ctype": "Use Ctype for e.g. hexadecimal digit detection", + "ext-fileinfo": "Use Fileinfo for better binary file detection", + "ext-iconv": "Use iconv for best performance", + "ext-intl": "Use Intl for best performance", + "ext-json": "Use JSON for string detection", + "ext-mbstring": "Use Mbstring for best performance" + }, + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "(Apache-2.0 or GPL-2.0)" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Hamid Sarfraz", + "homepage": "http://pageconfig.com/" + }, + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable UTF-8 library - performance optimized (unicode) string functions for php.", + "homepage": "https://github.com/voku/portable-utf8", + "keywords": [ + "UTF", + "clean", + "php", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "issues": "https://github.com/voku/portable-utf8/issues", + "source": "https://github.com/voku/portable-utf8/tree/6.0.13" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-utf8", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-utf8", + "type": "tidelift" + } + ], + "time": "2023-03-08T08:35:38+00:00" + }, + { + "name": "voku/stop-words", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/voku/stop-words.git", + "reference": "8e63c0af20f800b1600783764e0ce19e53969f71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/stop-words/zipball/8e63c0af20f800b1600783764e0ce19e53969f71", + "reference": "8e63c0af20f800b1600783764e0ce19e53969f71", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Stop-Words via PHP", + "keywords": [ + "stop words", + "stop-words" + ], + "support": { + "issues": "https://github.com/voku/stop-words/issues", + "source": "https://github.com/voku/stop-words/tree/master" + }, + "time": "2018-11-23T01:37:27+00:00" + }, + { + "name": "voku/stringy", + "version": "6.5.3", + "source": { + "type": "git", + "url": "https://github.com/voku/Stringy.git", + "reference": "c453c88fbff298f042c836ef44306f8703b2d537" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/Stringy/zipball/c453c88fbff298f042c836ef44306f8703b2d537", + "reference": "c453c88fbff298f042c836ef44306f8703b2d537", + "shasum": "" + }, + "require": { + "defuse/php-encryption": "~2.0", + "ext-json": "*", + "php": ">=7.0.0", + "voku/anti-xss": "~4.1", + "voku/arrayy": "~7.8", + "voku/email-check": "~3.1", + "voku/portable-ascii": "~2.0", + "voku/portable-utf8": "~6.0", + "voku/urlify": "~5.0" + }, + "replace": { + "danielstjules/stringy": "~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Create.php" + ], + "psr-4": { + "Stringy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel St. Jules", + "email": "danielst.jules@gmail.com", + "homepage": "http://www.danielstjules.com", + "role": "Maintainer" + }, + { + "name": "Lars Moelleken", + "email": "lars@moelleken.org", + "homepage": "https://www.moelleken.org/", + "role": "Fork-Maintainer" + } + ], + "description": "A string manipulation library with multibyte support", + "homepage": "https://github.com/danielstjules/Stringy", + "keywords": [ + "UTF", + "helpers", + "manipulation", + "methods", + "multibyte", + "string", + "utf-8", + "utility", + "utils" + ], + "support": { + "issues": "https://github.com/voku/Stringy/issues", + "source": "https://github.com/voku/Stringy" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/stringy", + "type": "tidelift" + } + ], + "time": "2022-03-28T14:52:20+00:00" + }, + { + "name": "voku/urlify", + "version": "5.0.7", + "source": { + "type": "git", + "url": "https://github.com/voku/urlify.git", + "reference": "014b2074407b5db5968f836c27d8731934b330e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/urlify/zipball/014b2074407b5db5968f836c27d8731934b330e4", + "reference": "014b2074407b5db5968f836c27d8731934b330e4", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "voku/portable-ascii": "~2.0", + "voku/portable-utf8": "~6.0", + "voku/stop-words": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\helper\\": "src/voku/helper/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Johnny Broadway", + "email": "johnny@johnnybroadway.com", + "homepage": "http://www.johnnybroadway.com/" + }, + { + "name": "Lars Moelleken", + "email": "lars@moelleken.org", + "homepage": "https://moelleken.org/" + } + ], + "description": "PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.", + "homepage": "https://github.com/voku/urlify", + "keywords": [ + "encode", + "iconv", + "link", + "slug", + "translit", + "transliterate", + "transliteration", + "url", + "urlify" + ], + "support": { + "issues": "https://github.com/voku/urlify/issues", + "source": "https://github.com/voku/urlify/tree/5.0.7" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/urlify", + "type": "tidelift" + } + ], + "time": "2022-01-24T19:08:46+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": "^7.2 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.11.0" + }, + "time": "2022-06-03T18:03:27+00:00" }, { "name": "zircote/swagger-php", From 38150e345634de3768d8e1448e12bdb72a236a99 Mon Sep 17 00:00:00 2001 From: John Berube Date: Mon, 30 Dec 2024 17:04:06 -0500 Subject: [PATCH 52/57] Adds AllowDynamicProperties to Avro libraries to prevent deprecated message. --- lib/Avro/DataIO/DataIO.php | 2 +- lib/Avro/DataIO/DataIOReader.php | 2 +- lib/Avro/DataIO/DataIOWriter.php | 2 +- lib/Avro/Datum/IODatumReader.php | 2 +- lib/Avro/Protocol/Protocol.php | 2 +- lib/Avro/Protocol/ProtocolMessage.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Avro/DataIO/DataIO.php b/lib/Avro/DataIO/DataIO.php index 305fbf2..e766f95 100644 --- a/lib/Avro/DataIO/DataIO.php +++ b/lib/Avro/DataIO/DataIO.php @@ -167,4 +167,4 @@ protected static function open_reader(IO $io, Schema $schema = null) return new DataIOReader($io, $reader); } -} \ No newline at end of file +} diff --git a/lib/Avro/DataIO/DataIOReader.php b/lib/Avro/DataIO/DataIOReader.php index 566e8bb..feb4971 100644 --- a/lib/Avro/DataIO/DataIOReader.php +++ b/lib/Avro/DataIO/DataIOReader.php @@ -195,4 +195,4 @@ private function read_block_header() return $this->decoder->read_long(); } -} \ No newline at end of file +} diff --git a/lib/Avro/DataIO/DataIOWriter.php b/lib/Avro/DataIO/DataIOWriter.php index d10ced5..92dfb65 100644 --- a/lib/Avro/DataIO/DataIOWriter.php +++ b/lib/Avro/DataIO/DataIOWriter.php @@ -193,4 +193,4 @@ private function seek($offset, $whence) { return $this->io->seek($offset, $whence); } -} \ No newline at end of file +} diff --git a/lib/Avro/Datum/IODatumReader.php b/lib/Avro/Datum/IODatumReader.php index 63697f3..6b26e5a 100644 --- a/lib/Avro/Datum/IODatumReader.php +++ b/lib/Avro/Datum/IODatumReader.php @@ -419,4 +419,4 @@ private function skip_data(Schema $writers_schema, IOBinaryDecoder $decoder) $writers_schema->type())); } } -} \ No newline at end of file +} diff --git a/lib/Avro/Protocol/Protocol.php b/lib/Avro/Protocol/Protocol.php index 56dd198..7967b79 100644 --- a/lib/Avro/Protocol/Protocol.php +++ b/lib/Avro/Protocol/Protocol.php @@ -44,4 +44,4 @@ function real_parse($avro) } } } -} \ No newline at end of file +} diff --git a/lib/Avro/Protocol/ProtocolMessage.php b/lib/Avro/Protocol/ProtocolMessage.php index 15f94e3..4c6583b 100644 --- a/lib/Avro/Protocol/ProtocolMessage.php +++ b/lib/Avro/Protocol/ProtocolMessage.php @@ -27,4 +27,4 @@ public function __construct($name, $avro, Protocol $protocol) $this->response = new PrimitiveSchema($avro{'response'}); } } -} \ No newline at end of file +} From 4d1b3534dac018b12e1fcbf8ce2e5d405c45f554 Mon Sep 17 00:00:00 2001 From: John Berube Date: Mon, 30 Dec 2024 17:11:42 -0500 Subject: [PATCH 53/57] Updates db methods to use new FAAPZ PDO API. --- src/Model/ModelTrait/DBReadTrait.php | 90 +++++++++++--------- src/Slim/ExtendedSelectOrUpdateInterface.php | 24 ++++++ src/Slim/ExtendedSelectStatement.php | 5 +- src/Slim/ExtendedUpdateStatement.php | 4 +- 4 files changed, 77 insertions(+), 46 deletions(-) create mode 100644 src/Slim/ExtendedSelectOrUpdateInterface.php diff --git a/src/Model/ModelTrait/DBReadTrait.php b/src/Model/ModelTrait/DBReadTrait.php index 1edf78c..0f5dc92 100644 --- a/src/Model/ModelTrait/DBReadTrait.php +++ b/src/Model/ModelTrait/DBReadTrait.php @@ -10,16 +10,14 @@ use NYPL\Starter\Model; use NYPL\Starter\ModelSet; use NYPL\Starter\OrderBy; -use NYPL\Starter\Slim\ExtendedSelectStatement; -use Slim\PDO\Statement\SelectStatement; +use NYPL\Starter\Slim\ExtendedSelectOrUpdateInterface; use FaaPz\PDO\Clause\Limit; -use FaaPz\PDO\StatementInterface; trait DBReadTrait { /** * @throws APIException - * @return ExtendedSelectStatement + * @return ExtendedSelectOrUpdateInterface */ protected function getSingleSelect() { @@ -76,11 +74,11 @@ protected function getOperator(Filter $filter) /** * @param int $count * @param Filter $filter - * @param StatementInterface $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement * * @return bool */ - protected function applyOrWhere($count, Filter $filter, StatementInterface $selectStatement) + protected function applyOrWhere($count, Filter $filter, ExtendedSelectOrUpdateInterface $selectStatement) { if (!$count) { $this->addWhere($filter, $selectStatement); @@ -88,31 +86,37 @@ protected function applyOrWhere($count, Filter $filter, StatementInterface $sele return true; } - $selectStatement->orWhere( + $conditional = new Conditional( $this->translateDbName($filter->getFilterColumn()), $this->getOperator($filter), $filter->getFilterValue() ); + if (method_exists($selectStatement, 'getWhere') && $existingWhere = $selectStatement->getWhere()) { + $grouping = new Grouping('OR', $conditional, $existingWhere); + } else { + $grouping = $conditional; + } + $selectStatement->where($grouping); + return true; } /** * @param int $count * @param Filter $filter - * @param StatementInterface $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement * * @return bool */ - protected function applyAndWhere($count, Filter $filter, StatementInterface $selectStatement) + protected function applyAndWhere($count, Filter $filter, ExtendedSelectOrUpdateInterface $selectStatement) { if (!$count) { - $selectStatement->orWhere( + $selectStatement->where(new Conditional( $this->translateDbName($filter->getFilterColumn()), $this->getOperator($filter), $filter->getFilterValue() - ); - + )); return true; } @@ -123,9 +127,9 @@ protected function applyAndWhere($count, Filter $filter, StatementInterface $sel /** * @param OrFilter $filter - * @param ExtendedSelectStatement $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement */ - protected function addOrWhere(OrFilter $orFilter, ExtendedSelectStatement $selectStatement) + protected function addOrWhere(OrFilter $orFilter, ExtendedSelectOrUpdateInterface $selectStatement) { $selectStatement->addParenthesis(); @@ -142,12 +146,12 @@ protected function addOrWhere(OrFilter $orFilter, ExtendedSelectStatement $selec /** * @param Filter $filter - * @param StatementInterface $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement * * @return bool * @throws APIException */ - protected function addWhere(Filter $filter, StatementInterface $selectStatement) + protected function addWhere(Filter $filter, ExtendedSelectOrUpdateInterface $selectStatement) { if ($filter instanceof OrFilter) { $this->addOrWhere($filter, $selectStatement); @@ -162,15 +166,23 @@ protected function addWhere(Filter $filter, StatementInterface $selectStatement) } if ($filter->getFilterValue() === null) { - $selectStatement->whereNull( - $this->translateDbName($filter->getFilterColumn()) - ); + $selectStatement->where(new Conditional( + $this->translateDbName($filter->getFilterColumn()), + "IS", + null + )); return true; } if (is_array($filter->getFilterValue())) { - $selectStatement->whereIn($filter->getFilterColumn(), $filter->getFilterValue()); + $selectStatement->where(new Conditional( + $filter->getFilterColumn(), + "IN", + $filter->getFilterValue() + )); + + return true; return true; } @@ -188,12 +200,12 @@ protected function addWhere(Filter $filter, StatementInterface $selectStatement) /** * @param Filter $filter - * @param StatementInterface $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement * * @return bool * @throws APIException */ - protected function addJsonWhere(Filter $filter, StatementInterface $selectStatement) + protected function addJsonWhere(Filter $filter, ExtendedSelectOrUpdateInterface $selectStatement) { $values = explode(',', $filter->getFilterValue()); @@ -214,12 +226,12 @@ protected function addJsonWhere(Filter $filter, StatementInterface $selectStatem /** * @param Filter $filter - * @param StatementInterface $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement * * @return bool * @throws APIException */ - protected function applyRange(Filter $filter, StatementInterface $selectStatement) + protected function applyRange(Filter $filter, ExtendedSelectOrUpdateInterface $selectStatement) { $this->setOrderBy($this->translateDbName($filter->getFilterColumn())); @@ -259,27 +271,29 @@ protected function applyRange(Filter $filter, StatementInterface $selectStatemen return true; } - $selectStatement->whereBetween( + $selectStatement->where(new Conditional( $this->translateDbName($filter->getFilterColumn()), + 'BETWEEN', $range - ); - } + )); + return true; + } /** * @param Filter $filter - * @param StatementInterface $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement * * @return bool */ - protected function applyWhere(Filter $filter, StatementInterface $selectStatement) + protected function applyWhere(Filter $filter, ExtendedSelectOrUpdateInterface $selectStatement) { if (strpos($filter->getFilterValue(), ',') !== false) { - $selectStatement->whereIn( + $selectStatement->where(new Conditional( $this->translateDbName($filter->getFilterColumn()), + "IN", explode(',', $filter->getFilterValue()) - ); - + )); return true; } @@ -323,12 +337,8 @@ protected function setSet($ignoreNoRecord = false) $this->applyOrderBy($selectStatement); } - if ($this->getOffset()) { - $selectStatement->offset($this->getOffset()); - } - if ($this->getLimit()) { - $selectStatement->limit(new Limit($this->getLimit())); + $selectStatement->limit(new Limit($this->getLimit(), $this->getOffset() ?? NULL)); } $selectStatement = $selectStatement->execute(); @@ -361,11 +371,11 @@ protected function setSet($ignoreNoRecord = false) } /** - * @param ExtendedSelectStatement $selectStatement + * @param ExtendedSelectOrUpdateInterface $selectStatement * * @return bool */ - protected function applyOrderBy(ExtendedSelectStatement $selectStatement) + protected function applyOrderBy(ExtendedSelectOrUpdateInterface $selectStatement) { if (is_array($this->getOrderBy())) { /** @@ -407,7 +417,7 @@ protected function obtainTotalCount() $this->applyFilters($this->getFilters(), $selectStatement); } - $selectStatement = $selectStatement->count()->execute(); + $selectStatement = $selectStatement->execute(); $this->setTotalCount($selectStatement->fetchColumn(0)); diff --git a/src/Slim/ExtendedSelectOrUpdateInterface.php b/src/Slim/ExtendedSelectOrUpdateInterface.php new file mode 100644 index 0000000..981e114 --- /dev/null +++ b/src/Slim/ExtendedSelectOrUpdateInterface.php @@ -0,0 +1,24 @@ + Date: Tue, 31 Dec 2024 13:17:14 -0500 Subject: [PATCH 54/57] Updates IS NULL syntax. --- src/Model/ModelTrait/DBReadTrait.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Model/ModelTrait/DBReadTrait.php b/src/Model/ModelTrait/DBReadTrait.php index 0f5dc92..2d7421d 100644 --- a/src/Model/ModelTrait/DBReadTrait.php +++ b/src/Model/ModelTrait/DBReadTrait.php @@ -12,6 +12,7 @@ use NYPL\Starter\OrderBy; use NYPL\Starter\Slim\ExtendedSelectOrUpdateInterface; use FaaPz\PDO\Clause\Limit; +use FaaPz\PDO\Clause\Raw; trait DBReadTrait { @@ -169,7 +170,7 @@ protected function addWhere(Filter $filter, ExtendedSelectOrUpdateInterface $sel $selectStatement->where(new Conditional( $this->translateDbName($filter->getFilterColumn()), "IS", - null + new Raw("NULL") )); return true; @@ -179,10 +180,9 @@ protected function addWhere(Filter $filter, ExtendedSelectOrUpdateInterface $sel $selectStatement->where(new Conditional( $filter->getFilterColumn(), "IN", - $filter->getFilterValue() - )); + $filter->getFilterValue(), - return true; + )); return true; } From ed23456676669f6850b35b71ac2a8f3f92a077ae Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 2 Jan 2025 15:41:44 -0500 Subject: [PATCH 55/57] Cleans up AvroDeserializer.php --- src/AvroDeserializer.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AvroDeserializer.php b/src/AvroDeserializer.php index 7f3e38e..ecb4c48 100644 --- a/src/AvroDeserializer.php +++ b/src/AvroDeserializer.php @@ -1,8 +1,9 @@ Date: Thu, 2 Jan 2025 15:42:08 -0500 Subject: [PATCH 56/57] Cleans up Controller.php --- src/Controller.php | 55 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/Controller.php b/src/Controller.php index 24ce553..5c77716 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -8,7 +8,7 @@ use Psr\Http\Message\MessageInterface; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -use \GuzzleHttp\Psr7\Stream; +use GuzzleHttp\Psr7\Stream; abstract class Controller { @@ -30,7 +30,7 @@ abstract class Controller public $request; /** - * @var Response|ResponseInterface + * @var Response */ public $response; @@ -46,10 +46,10 @@ abstract class Controller /** * @param Request $request - * @param Response|ResponseInterface $response + * @param Response $response * @param int $cacheSeconds */ - public function __construct(Request $request, Response $response, $cacheSeconds = 0) + public function __construct(Request $request, Response $response, int $cacheSeconds = 0) { $this->setRequest($request); $this->setResponse($response); @@ -64,7 +64,7 @@ public function __construct(Request $request, Response $response, $cacheSeconds /** * @return Request */ - public function getRequest() + public function getRequest(): Request { return $this->request; } @@ -78,15 +78,15 @@ public function setRequest(Request $request) } /** - * @return Response|ResponseInterface + * @return Response */ - public function getResponse() + public function getResponse(): Response { return $this->response; } /** - * @param Response|ResponseInterface $response + * @param Response $response */ public function setResponse(Response $response) { @@ -94,9 +94,10 @@ public function setResponse(Response $response) } /** + * @param $data * @return MessageInterface */ - public function getJsonResponse($data) + public function getJsonResponse($data): MessageInterface { $json = json_encode($data); $streamBody = fopen('data://text/plain,' . $json,'r'); @@ -106,7 +107,7 @@ public function getJsonResponse($data) /** * @return string */ - public function getContentType() + public function getContentType(): string { return $this->contentType; } @@ -114,7 +115,7 @@ public function getContentType() /** * @param string $contentType */ - public function setContentType($contentType) + public function setContentType(string $contentType) { if ($contentType) { $this->setResponse( @@ -143,9 +144,8 @@ public function setIdentityHeader(IdentityHeader $identityHeader) /** * @return string - * @throws APIException */ - public function determineContentType() + public function determineContentType(): string { $acceptedContentTypes = $this->getRequest()->getHeaderLine(self::ACCEPT_HEADER); @@ -178,7 +178,7 @@ public function initializeContentType() * * @return string */ - public function bufferOutput(callable $bufferedFunction) + public function bufferOutput(callable $bufferedFunction): string { ob_start(); $bufferedFunction(); @@ -191,7 +191,7 @@ public function bufferOutput(callable $bufferedFunction) /** * @return bool */ - public function initializeIdentityHeader() + public function initializeIdentityHeader(): bool { if ($this->getRequest()->hasHeader(self::IDENTITY_HEADER)) { $this->setIdentityHeader(new IdentityHeader( @@ -227,18 +227,19 @@ protected function generateId(Source $source) * * @return bool */ - protected function addQueryFilter(ModelSet $model, $queryParameterName = '') + protected function addQueryFilter(ModelSet $model, string $queryParameterName = ''): bool { if ($this->getQueryParam($queryParameterName)) { $filter = new QueryFilter( $queryParameterName, $this->getQueryParam($queryParameterName) ); - $model->addFilter($filter); return true; } + + return false; } /** @@ -247,7 +248,7 @@ protected function addQueryFilter(ModelSet $model, $queryParameterName = '') * @param Filter|null $filter * @param array $queryParameters * - * @return Response + * @return MessageInterface * @throws APIException */ protected function getDefaultReadResponse( @@ -255,13 +256,14 @@ protected function getDefaultReadResponse( SuccessResponse $response, Filter $filter = null, array $queryParameters = [] - ) { + ): MessageInterface + { if ($model instanceof ModelSet) { $model->setOffset($this->getQueryParam('offset')); $model->setLimit($this->getQueryParam('limit')); - $includeTotalCount = $this->getQueryParam('includeTotalCount') === 'true' ? true : false ; + $includeTotalCount = ($this->getQueryParam('includeTotalCount') === 'true'); if ($includeTotalCount) { $model->setIncludeTotalCount($includeTotalCount); @@ -303,9 +305,9 @@ protected function getDefaultReadResponse( * * @return bool */ - public function addCacheHeader($numberSeconds = 0) + public function addCacheHeader(int $numberSeconds = 0): bool { - if ($numberSeconds && $this->getRequest()->isGet()) { + if ($numberSeconds && $this->getRequest()->getMethod() == 'GET') { $this->setResponse( $this->getResponse()->withHeader( "Cache-Control", @@ -324,7 +326,7 @@ public function addCacheHeader($numberSeconds = 0) * * @return bool */ - public function isAllowed($patronId = '') + public function isAllowed(string $patronId = ''): bool { if (!$this->getIdentityHeader()->isExists()) { return true; @@ -339,11 +341,10 @@ public function isAllowed($patronId = '') /** * @param array $allowedScopes - * + * @return true|void * @throws APIException - * @return bool */ - public function checkScopes($allowedScopes = []) + public function checkScopes(array $allowedScopes = []) { if (!$this->getIdentityHeader()->isExists()) { return true; @@ -363,7 +364,7 @@ public function checkScopes($allowedScopes = []) * * @throws APIException */ - public function denyAccess($message = '') + public function denyAccess(string $message = '') { throw new APIException( 'Insufficient access for endpoint: ' . $message, From 76d2fc23e65841de81e0e5bbc00db8741839590f Mon Sep 17 00:00:00 2001 From: John Berube Date: Thu, 2 Jan 2025 15:42:22 -0500 Subject: [PATCH 57/57] Cleans up Service.php. --- src/Service.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Service.php b/src/Service.php index 08ff7ff..2a93f26 100644 --- a/src/Service.php +++ b/src/Service.php @@ -3,12 +3,9 @@ use Aura\Di\Container; use Aura\Di\ContainerBuilder; -use Aura\Di\Injection\InjectionFactory; use Slim\App; use Slim\Factory\AppFactory; -use GuzzleHttp\Psr7\Request; -use GuzzleHttp\Psr7\Response; -use NYPL\Starter\DefaultMiddleware; + class Service extends App { const CACHE_SECONDS_OPTIONS_REQUEST = 600;