{"id":16674462,"url":"https://github.com/settermjd/url-redirector","last_synced_at":"2025-10-17T10:59:32.302Z","repository":{"id":57048347,"uuid":"98523167","full_name":"settermjd/url-redirector","owner":"settermjd","description":"This is a simple package that simplifies the process of performing redirects from one absolute URL to another. It's not meant to be, in any way, sophisticated.","archived":false,"fork":false,"pushed_at":"2018-02-06T02:56:32.000Z","size":9,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T11:48:02.993Z","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/settermjd.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":"2017-07-27T10:21:31.000Z","updated_at":"2018-02-06T02:21:29.000Z","dependencies_parsed_at":"2022-08-23T19:10:23.458Z","dependency_job_id":null,"html_url":"https://github.com/settermjd/url-redirector","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/settermjd/url-redirector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Furl-redirector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Furl-redirector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Furl-redirector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Furl-redirector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/settermjd","download_url":"https://codeload.github.com/settermjd/url-redirector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Furl-redirector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279330890,"owners_count":26149893,"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","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-12T12:43:18.075Z","updated_at":"2025-10-17T10:59:32.282Z","avatar_url":"https://github.com/settermjd.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Absolute URL Redirector\n\nThis is a simple package that simplifies the process of performing redirects from one absolute URL to another. \nIt's not meant to be, in any way, sophisticated.\n\n## Installing\n\nTo install the module, use Composer by running `composer require settermjd/url-redirector`.\n\n## Getting Started\n\nThe constructor takes two arguments:\n\n1. An array. This is a simple key/value list of URLs that require redirecting, and where they should be redirected to\n2. The currently requested URL. \n\nThe package provides two functions: \n\n- `requiresRedirect()`: This tests if the requested URL requires a redirect\n- `getRedirectUrl()`: This retrieves the URL that the current request should be redirected to\n\nIf you just want to test, use the first, if you want to redirect, use the second, which uses the first internally.\n\nAfter initializing the object, pass the return value from `getRedirectUrl()` to PHP's [header](http://php.net/manual/de/function.header.php) function, as in the example below, and the request will be redirected.\n\n```php\n\u003c?php\n\nrequire_once('vendor/autoload.php');\n\n$redirectList = [];\n$requestUrl = '';  // the requested URL\n\n$redirector = new Redirector\\Redirector($redirectList, $requestUrl);\n\nif ($redirector-\u003erequiresRedirect()) {\n    header(sprintf('Location: %s', $redirector-\u003egetRedirectUrl()));\n    exit;\n}\n``` \n\n## Running the Tests\n\nTo run the unit tests, run `composer test`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettermjd%2Furl-redirector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsettermjd%2Furl-redirector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettermjd%2Furl-redirector/lists"}