{"id":37001910,"url":"https://github.com/folded-php/url","last_synced_at":"2026-01-14T00:25:01.617Z","repository":{"id":56982414,"uuid":"298377566","full_name":"folded-php/url","owner":"folded-php","description":"URL utilities for your web app.","archived":false,"fork":false,"pushed_at":"2020-10-17T07:48:54.000Z","size":39,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-28T12:20:02.415Z","etag":null,"topics":["php","url"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/folded/url","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/folded-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-24T19:35:22.000Z","updated_at":"2020-10-16T19:42:38.000Z","dependencies_parsed_at":"2022-08-21T11:20:55.136Z","dependency_job_id":null,"html_url":"https://github.com/folded-php/url","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/folded-php/url","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Furl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Furl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Furl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Furl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folded-php","download_url":"https://codeload.github.com/folded-php/url/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Furl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","url"],"created_at":"2026-01-14T00:25:01.121Z","updated_at":"2026-01-14T00:25:01.604Z","avatar_url":"https://github.com/folded-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# folded/config\n\nURL utilities for your PHP web app.\n\n[![Packagist License](https://img.shields.io/packagist/l/folded/url)](https://github.com/folded-php/url/blob/master/LICENSE) [![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/folded/url)](https://github.com/folded-php/url/blob/master/composer.json#L14) [![Packagist Version](https://img.shields.io/packagist/v/folded/url)](https://packagist.org/packages/folded/url) [![Build Status](https://travis-ci.com/folded-php/url.svg?branch=master)](https://travis-ci.com/folded-php/url) [![Maintainability](https://api.codeclimate.com/v1/badges/1968f36aaf19246dcc16/maintainability)](https://codeclimate.com/github/folded-php/url/maintainability) [![TODOs](https://img.shields.io/endpoint?url=https://api.tickgit.com/badge?repo=github.com/folded-php/url)](https://www.tickgit.com/browse?repo=github.com/folded-php/url)\n\n## Summary\n\n- [About](#about)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Examples](#examples)\n- [Version support](#version-support)\n\n## About\n\nI created this library to have an easy way to use common URL functions like getting the current URL, in a standalone way.\n\nFolded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.\n\n- [folded/action](https://github.com/folded-php/action): A way to organize your controllers for your web app.\n- [folded/config](https://github.com/folded-php/config): Configuration and environment utilities for your PHP web app.\n- [folded/crypt](https://github.com/folded-php/crypt): Encrypt and decrypt strings for your web app.\n- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.\n- [folded/history](https://github.com/folded-php/history): Manipulate the browser history for your web app.\n- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.\n- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.\n- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.\n- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.\n- [folded/session](https://github.com/folded-php/session): Session functions for your web app.\n- [folded/view](https://github.com/folded-php/view): View utilities for your PHP web app.\n\n## Features\n\n## Requirements\n\n- PHP version \u003e= 7.4.0\n- Composer installed\n\n## Installation\n\nIn your project root folder, run this command:\n\n```bash\ncomposer require folded/url\n```\n\n## Examples\n\n- [1. Check if the current URL matches a given URL](#1-check-if-the-current-url-matches-a-given-url)\n- [2. Get the current URL](#2-get-the-current-url)\n- [3. Get a query string value by key name](#3-get-a-query-string-value-by-key-name)\n- [4. Get all the query strings](#4-get-all-the-query-strings)\n- [5. Check if a query string is present by key name](#5-check-if-a-query-string-is-present-by-key-name)\n\n### 1. Check if the current URL matches a given URL\n\nIn this example, we will check if the current URL matches a given URL.\n\n```php\nuse function Folded\\currentUrlIs;\n\nif (currentUrlIs(\"/about-us\")) {\n  echo \"We are on page /about-us\";\n} else {\n  echo \"We are somewhere else\";\n}\n```\n\n### 2. Get the current URL\n\nIn this example, we will get the current URL, including the server protocol, domain, and eventuals query strings.\n\n```php\nuse function Folded\\getCurrentUrl;\n\necho getCurrentUrl(); // \"https://example.com/about-us?page=1\"\n```\n\n### 3. Get a query string value by key name\n\nIn this example, we will get the value of a query string by its key name.\n\n```php\nuse function Folded\\getQueryString;\n\n// Assuming we are on page https://example.com/about-us?page=1\n\necho getQueryString(\"page\"); // \"1\"\n```\n\nIf the query string is not present, the function will throw an exception. To avoid this, you can use the second parameter to provide a fallback value in case the query string is not found.\n\n```php\nuse function Folded\\getQueryString;\n\necho getQueryString(\"page\", \"1\");\n```\n\n### 4. Get all the query strings\n\nIn this example, we will get all the query strings as an associative array.\n\n```php\nuse function Folded\\getQueryStrings;\n\n// Assuming we are on page https://example.com/about-us?page=1\u0026view=list\n\n$queryStrings = getQueryStrings();\n\nforeach ($queryStrings as $key =\u003e $value) {\n  echo \"value of $key is $value\";\n}\n```\n\n### 5. Check if a query string is present by key name\n\nIn this example, we will check if a query string is present.\n\n```php\nuse function Folded\\hasQueryString;\n\nif (hasQueryString(\"page\")) {\n  echo \"We can grab its value\";\n} else {\n  echo \"Do something else without it\";\n}\n```\n\n## Version support\n\n|        | 7.3 | 7.4 | 8.0 |\n| ------ | --- | --- | --- |\n| v0.1.0 | ❌  | ✔️  | ❓  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Furl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolded-php%2Furl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Furl/lists"}