{"id":16136718,"url":"https://github.com/prinx/url","last_synced_at":"2025-04-06T16:40:56.639Z","repository":{"id":57044702,"uuid":"384373080","full_name":"prinx/url","owner":"prinx","description":"URL utilities for PHP","archived":false,"fork":false,"pushed_at":"2021-07-09T09:16:58.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T22:37:14.088Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/prinx.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":"2021-07-09T08:30:51.000Z","updated_at":"2021-07-09T09:06:27.000Z","dependencies_parsed_at":"2022-08-24T03:40:12.785Z","dependency_job_id":null,"html_url":"https://github.com/prinx/url","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prinx%2Furl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prinx%2Furl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prinx%2Furl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prinx%2Furl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prinx","download_url":"https://codeload.github.com/prinx/url/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247517058,"owners_count":20951708,"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":[],"created_at":"2024-10-09T23:12:56.703Z","updated_at":"2025-04-06T16:40:56.614Z","avatar_url":"https://github.com/prinx.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URL\n\nURL utilities for PHP\n\n\u003cp\u003e\n\u003ca href=\"https://github.com/prinx/url/actions/workflows/tests.yml\"\u003e\u003cimg src=\"https://github.com/prinx/url/actions/workflows/tests.yml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/prinx/url\"\u003e\u003cimg src=\"https://poser.pugx.org/prinx/url/v/stable.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/prinx/url\"\u003e\u003cimg src=\"https://poser.pugx.org/prinx/url/license.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n## Installation\n\n```shell\ncomposer require prinx/url\n```\n\n## Usage\n\n### Create an instance of the utility class\n\n```php\n$url = new \\Prinx\\Url;\n```\n\n### Add query string to URL\n\n```php\n$newUrl = $url-\u003eaddQueryString('https://test.com', ['action' =\u003e 'test']); // https://test.com?action=test\n$newUrl = $url-\u003eaddQueryString('https://test.com?name=url', ['action' =\u003e 'test']); // https://test.com?name=url\u0026action=test\n```\n\n### Get URL parts\n\n```php\n$urlParts = $url-\u003egetParts('https://test.com?name=url');\n\n/*\n[\n  'scheme' =\u003e 'https'\n  'host'   =\u003e 'test.com'\n  'path'   =\u003e '/path/'\n  'query'  =\u003e 'query=string\u0026action=test\u0026name=url'\n]\n*/\n```\n\n```php\n$urlParts = $url-\u003egetParts('https://user:password@test.com:85/path/?action=test\u0026name=url#faq');\n\n/*\n[\n  'scheme'   =\u003e  'https'\n  'host'     =\u003e  'test.com'\n  'port'     =\u003e  85\n  'user'     =\u003e  'user'\n  'pass'     =\u003e  'password'\n  'path'     =\u003e  '/path/'\n  'query'    =\u003e  'action=test\u0026name=url'\n  'fragment' =\u003e  'faq'\n]\n*/\n```\n\n### Get query string\n\n```php\n$queryStrings = $url-\u003egetQueryStrings('https://test.com?name=url\u0026action=test');\n\n// ['name' =\u003e 'url', 'action' =\u003e 'test']\n```\n\n### Remove query string from URL\n\n```php\n$newUrl = $url-\u003eremoveQueryString('https://test.com?name=url\u0026action=test', 'name');\n\n// https://test.com?action=test\n```\n\n```php\n$newUrl = $url-\u003eremoveQueryString('https://test.com?name=url\u0026action=test', ['name', 'action']);\n\n// https://test.com\n```\n\n## Contribute\n\nStar :star: the repo, fork it, fix a bug, add a new feature, write tests, correct documentation, and submit a pull request.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprinx%2Furl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprinx%2Furl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprinx%2Furl/lists"}