diff --git a/composer.json b/composer.json index 6100b61a..e8afc170 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,6 @@ "league/plates": "^3.3", "vlucas/valitron": "^1.4", "php-extended/php-tail": "^2.1", - "pguardiario/phpuri": "^1.0", "symfony/lock": "^6.0", "ezyang/htmlpurifier": "^4.10", "xemlock/htmlpurifier-html5": "^0.1.7", @@ -27,7 +26,8 @@ "illuminate/database": "^9.12", "illuminate/events": "^9.12", "php-ds/php-ds": "^1.4", - "hided62/ldto": "^1.0" + "hided62/ldto": "^1.0", + "league/uri": "^6.8" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ebfcb71c..a91f5f74 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": "fe4387d1f2df3d3162c053a1d50a733a", + "content-hash": "d7acaa437c3c6f48c9a643c9dc4ef421", "packages": [ { "name": "brandonwamboldt/utilphp", @@ -1194,6 +1194,177 @@ }, "time": "2020-12-25T05:00:37+00:00" }, + { + "name": "league/uri", + "version": "6.8.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/a700b4656e4c54371b799ac61e300ab25a2d1d39", + "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39", + "shasum": "" + }, + "require": { + "ext-json": "*", + "league/uri-interfaces": "^2.3", + "php": "^8.1", + "psr/http-message": "^1.0.1" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^v3.9.5", + "nyholm/psr7": "^1.5.1", + "php-http/psr7-integration-tests": "^1.1.1", + "phpbench/phpbench": "^1.2.6", + "phpstan/phpstan": "^1.8.5", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.1.1", + "phpstan/phpstan-strict-rules": "^1.4.3", + "phpunit/phpunit": "^9.5.24", + "psr/http-factory": "^1.0.1" + }, + "suggest": { + "ext-fileinfo": "Needed to create Data URI from a filepath", + "ext-intl": "Needed to improve host validation", + "league/uri-components": "Needed to easily manipulate URI objects", + "psr/http-factory": "Needed to use the URI factory" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "uri-template", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri/issues", + "source": "https://github.com/thephpleague/uri/tree/6.8.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2022-09-13T19:58:47+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.19", + "phpstan/phpstan": "^0.12.90", + "phpstan/phpstan-phpunit": "^0.12.19", + "phpstan/phpstan-strict-rules": "^0.12.9", + "phpunit/phpunit": "^8.5.15 || ^9.5" + }, + "suggest": { + "ext-intl": "to use the IDNA feature", + "symfony/intl": "to use the IDNA feature via Symfony Polyfill" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common interface for URI representation", + "homepage": "http://github.com/thephpleague/uri-interfaces", + "keywords": [ + "rfc3986", + "rfc3987", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/thephpleague/uri-interfaces/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2021-06-28T04:27:21+00:00" + }, { "name": "microsoft/tolerant-php-parser", "version": "v0.1.1", @@ -1610,34 +1781,6 @@ }, "time": "2022-01-24T11:29:14+00:00" }, - { - "name": "pguardiario/phpuri", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/monkeysuffrage/phpuri.git", - "reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/monkeysuffrage/phpuri/zipball/ad0a5ec033fe616cfef55578b9c7f2458be8fbfc", - "reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc", - "shasum": "" - }, - "type": "project", - "autoload": { - "files": [ - "phpuri.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "description": "A php library for converting relative urls to absolute.", - "support": { - "issues": "https://github.com/monkeysuffrage/phpuri/issues", - "source": "https://github.com/monkeysuffrage/phpuri/tree/1.0.0" - }, - "time": "2015-05-24T09:13:17+00:00" - }, { "name": "phan/phan", "version": "5.3.2", @@ -2077,6 +2220,59 @@ }, "time": "2021-11-05T16:47:00+00:00" }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.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": "http://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/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, { "name": "psr/log", "version": "3.0.0", diff --git a/src/kakao/Kakao_REST_API_Helper.php b/src/kakao/Kakao_REST_API_Helper.php index f95021ea..36a3ffb8 100644 --- a/src/kakao/Kakao_REST_API_Helper.php +++ b/src/kakao/Kakao_REST_API_Helper.php @@ -1,6 +1,7 @@ authority = $_SERVER['HTTP_HOST']; - $this->REDIRECT_URI = $uriObj->join(''); + $uriObj = Uri::createFromBaseUri(KakaoKey::REDIRECT_URI, $_SERVER['HTTP_HOST']); + $this->REDIRECT_URI = (string)$uriObj; } else{ $this->REDIRECT_URI = KakaoKey::REDIRECT_URI; diff --git a/src/sammo/WebUtil.php b/src/sammo/WebUtil.php index c4014db5..23ac74ce 100644 --- a/src/sammo/WebUtil.php +++ b/src/sammo/WebUtil.php @@ -3,6 +3,7 @@ namespace sammo; use phpDocumentor\Reflection\Types\Boolean; +use league\Uri\Uri; class WebUtil { @@ -17,7 +18,7 @@ class WebUtil public static function resolveRelativePath(string $path, string $basepath): string { - return \phpUri::parse($basepath)->join($path); + return (string)Uri::createFromBaseUri($path, $basepath); } public static function setHeaderNoCache() @@ -153,15 +154,15 @@ class WebUtil public static function preloadAsset(string $path, string $type) { - $upath = \phpUri::parse($path); - $path = $upath->join(''); - if (!$upath->scheme) { - if (!file_exists($upath->path)) { + $upath = Uri::createFromString($path); + $path = (string)$upath; + if (!$upath->getScheme()) { + if (!file_exists($upath->getPath())) { return "\n"; } - $mtime = filemtime($upath->path); - if ($upath->query) { + $mtime = filemtime($upath->getPath()); + if ($upath->getQuery()) { $tail = '&' . $mtime; } else { $tail = '?' . $mtime; @@ -188,7 +189,7 @@ class WebUtil $entryName = [$entryName]; } - $serverBasePath = \phpUri::parse(ServConfig::$serverWebPath)->path; + $serverBasePath = Uri::createFromString(ServConfig::$serverWebPath)->getPath(); if ($type == 'gateway') { $serverBasePath .= "/dist_js/{$type}"; @@ -227,14 +228,14 @@ class WebUtil public static function printJS(string $path, bool $isDefer = false) { //async 옵션 고려? - $upath = \phpUri::parse($path); - $path = $upath->join(''); - if (!$upath->scheme) { - if (!file_exists($upath->path)) { + $upath = Uri::createFromString($path); + $path = (string)$upath; + if (!$upath->getScheme()) { + if (!file_exists($upath->getPath())) { return "\n"; } - $mtime = filemtime($upath->path); - if ($upath->query) { + $mtime = filemtime($upath->getPath()); + if ($upath->getQuery()) { $tail = '&' . $mtime; } else { $tail = '?' . $mtime; @@ -249,14 +250,14 @@ class WebUtil public static function printCSS(string $path) { - $upath = \phpUri::parse($path); - $path = $upath->join(''); - if (!$upath->scheme) { - if (!file_exists($upath->path)) { + $upath = Uri::createFromString($path); + $path = (string)$upath; + if (!$upath->getScheme()) { + if (!file_exists($upath->getPath())) { return "\n"; } - $mtime = filemtime($upath->path); - if ($upath->query) { + $mtime = filemtime($upath->getPath()); + if ($upath->getQuery()) { $tail = '&' . $mtime; } else { $tail = '?' . $mtime; @@ -337,8 +338,7 @@ class WebUtil } public static function replaceDomain(string $origPath, string $newDomain): string{ - $upath = \phpUri::parse($origPath); - $upath->authority = $newDomain; - return $upath->join(''); + $upath = Uri::createFromBaseUri($origPath, $newDomain); + return (string)$upath; } }