{"id":16760433,"url":"https://github.com/ryanve/slash","last_synced_at":"2025-04-10T17:37:28.661Z","repository":{"id":62538694,"uuid":"2864121","full_name":"ryanve/slash","owner":"ryanve","description":"PHP URI and path utilities.","archived":false,"fork":false,"pushed_at":"2014-01-09T17:54:32.000Z","size":520,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T18:56:27.493Z","etag":null,"topics":["php","slash","uri","url"],"latest_commit_sha":null,"homepage":"https://ryanve.dev/slash/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-28T01:45:12.000Z","updated_at":"2025-01-22T19:49:41.000Z","dependencies_parsed_at":"2022-11-02T15:17:11.181Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/slash","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fslash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fslash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fslash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fslash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/slash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262036,"owners_count":21074237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","slash","uri","url"],"created_at":"2024-10-13T04:23:31.920Z","updated_at":"2025-04-10T17:37:28.644Z","avatar_url":"https://github.com/ryanve.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [slash](../../)\n\n#### PHP utility classes for URIs, paths, and files\n\n## API ([3.0](../../releases))\n\n### Classes\n\n- [\u003cb\u003eUri\u003c/b\u003e](#uri-methods) methods aim to be more practical and reliable than [`parse_url`](http://www.php.net/manual/en/function.parse-url.php). \n- [\u003cb\u003ePath\u003c/b\u003e](#path-methods) contains reliable methods for working with server filesystem paths.\n- [\u003cb\u003eFile\u003c/b\u003e](#file-methods) contains reliable methods for reading and writing files.\n- [\u003cb\u003eSlash\u003c/b\u003e](#slash-methods) contains string utilities inherited by `Path` and `Uri`.\n\n### [`Uri`](./slash/Uri.php) Methods\n\n\u003cpre\u003efoo://user:pass@example.com:800/dir/file.php?s=10\u0026amp;e=23#jump\n\\_/   \\_______/ \\_________/ \\_/              \\_______/ \\__/\n |        |          |       |                  |       |\n |     userinfo   hostname  port              query   fragment\n |    \\_______________________/\\___________/\n |            |                      |\nscheme    authority                 path\u003c/pre\u003e\n\n#### Methods are based on the [URI diagram](http://en.wikipedia.org/wiki/URI_scheme#Examples) or otherwise normalized between terms in [PHP](http://www.php.net/manual/en/function.parse-url.php), [JavaScript](https://developer.mozilla.org/en-US/docs/DOM/window.location), [jQuery Mobile](http://jquerymobile.com/test/docs/api/methods.html), and [node](http://nodejs.org/docs/v0.5.5/api/url.html).\n\n```php\n\\slash\\Uri::scheme($uri) // get scheme (excludes ':')\n\\slash\\Uri::prorel($uri) // convert to protocol relative\n\\slash\\Uri::prorel($uri, $scheme) // replace the scheme\n\\slash\\Uri::bar($uri) // get \"address bar\" uri\n\\slash\\Uri::authority($uri) // get authority\n\\slash\\Uri::hostname($uri) // get hostname\n\\slash\\Uri::prefetch($uri) // get uri for dns prefetch\n\\slash\\Uri::userinfo($uri) // get userinfo\n\\slash\\Uri::user($uri) // get username\n\\slash\\Uri::pass($uri) // get password\n\\slash\\Uri::port($uri) // get port number (string)\n\\slash\\Uri::hier($uri) // get hierarchial part\n\\slash\\Uri::path($uri) // get path part\n\\slash\\Uri::query($uri) // get query str (excludes '?')\n\\slash\\Uri::hash($uri) // get fragment  (includes '#')\n\\slash\\Uri::fragment($uri) // get fragment  (excludes '#')\n\\slash\\Uri::nohash($uri) // remove hash\n\\slash\\Uri::novars($uri) // remove hash and query\n\\slash\\Uri::parse($uri) // get object containing parts\n```\n\n### [`Slash`](./slash/Slash.php) Methods\n\n```php\n\\slash\\Slash::trim($path)\n\\slash\\Slash::ltrim($path)\n\\slash\\Slash::rtrim($path)\n\\slash\\Slash::slash($path)\n\\slash\\Slash::lslash($path)\n\\slash\\Slash::rslash($path)\n\\slash\\Slash::join(*$parts)\n\\slash\\Slash::split($path)\n\\slash\\Slash::normalize($path)\n```\n\n### [`File`](./slash/File.php) Methods\n\n```php\n\\slash\\File::exists($path)\n\\slash\\File::get($path, $done?)\n\\slash\\File::put($path, $data)\n\\slash\\File::load($path, $done)\n\\slash\\File::getJson($path, $done?)\n\\slash\\File::putJson($path, $data)\n```\n\n### [`Path`](./slash/Path.php) Methods\n\n```php\n\\slash\\Path::normalize($path)\n\\slash\\Path::root($relative?)\n\\slash\\Path::dir($relative?)\n\\slash\\Path::ext($path, $add?)\n\\slash\\Path::filename($file)\n\\slash\\Path::inc($file)\n\\slash\\Path::scan($path?)\n\\slash\\Path::tree($path?)\n\\slash\\Path::paths($path?)\n\\slash\\Path::files($path?)\n\\slash\\Path::dirs($path?)\n\\slash\\Path::exists($item)\n\\slash\\Path::isPath($item)\n\\slash\\Path::isFile($item)\n\\slash\\Path::isDir($item)\n\\slash\\Path::isDot($item)\n\\slash\\Path::isAbs($path) // test if path is absolute\n\\slash\\Path::toAbs($path) // resolve relative path\n\\slash\\Path::toUri($path, $scheme?) // defaults to protocol-relative\n\\slash\\Path::toUrl($path, $scheme?) // defaults to http or https\n\\slash\\Path::isHttps()\n\\slash\\Path::mtime($path)\n\\slash\\Path::ctime($path)\n\\slash\\Path::atime($path)\n\\slash\\Path::affix($list, $prefix, $suffix?)\n\\slash\\Path::infix($list, $infix)\n\\slash\\Path::depth($path)\n\\slash\\Path::tier($array)\n\\slash\\Path::sort($array)\n\\slash\\Path::locate($needles)\n\\slash\\Path::contains($haystack, $needle)\n\\slash\\Path::search($paths, $needles?)\n\\slash\\Path::find($list, $test)\n```\n\n### [`Mixin`](./slash/traits/Mixin.php) Methods\n\n#### Extend Any [Class](#classes)\n\n```php\n::mixin($name, $fn) // mixin a single method\n::mixin($array) // mixin methods from an associative array\n::mixin($object) // mixin methods from an object or class\n::method($name) // fully-qualify a method (returns callable)\n::methods($object?) // get array of all methods incl. mixins\n```\n\n## Fund\n\nFund development with [tips to @ryanve](https://www.gittip.com/ryanve/) =)\n\n## [MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (C) 2013 by [Ryan Van Etten](https://github.com/ryanve)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fslash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Fslash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fslash/lists"}