{"id":23790087,"url":"https://github.com/hash-bang/urlopts","last_synced_at":"2025-07-04T03:05:28.817Z","repository":{"id":15012856,"uuid":"17738451","full_name":"hash-bang/URLopts","owner":"hash-bang","description":"Nicer looking URLs for key/value pairs","archived":false,"fork":false,"pushed_at":"2014-04-08T04:41:46.000Z","size":164,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-04T03:03:05.985Z","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/hash-bang.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":"2014-03-14T07:21:40.000Z","updated_at":"2014-04-08T04:41:46.000Z","dependencies_parsed_at":"2022-09-07T03:51:58.917Z","dependency_job_id":null,"html_url":"https://github.com/hash-bang/URLopts","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hash-bang/URLopts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hash-bang%2FURLopts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hash-bang%2FURLopts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hash-bang%2FURLopts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hash-bang%2FURLopts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hash-bang","download_url":"https://codeload.github.com/hash-bang/URLopts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hash-bang%2FURLopts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263437344,"owners_count":23466367,"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":"2025-01-01T17:18:21.484Z","updated_at":"2025-07-04T03:05:28.786Z","avatar_url":"https://github.com/hash-bang.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"URLopts - CodeIgniter pretty URL option processing\n==================================================\nThis library provies a simple way to setup nice looking URLs.\n\nURLopts encodes various parameters into the URL string itself similar to a normal GET parameter but in a neater way.\n\nFor example the following URL shows the various components of a neatened URL:\n\n\thttp://website.com/controller/function/parameter1/value1/parameter2/value2/parameter3/value3\n\nURLopts provides a library for constructing and reading back URLs such as this within a CodeIgniter controller.\n\nInstallation\n============\nDownload this repo and copy into your application directory.\n\nAlternatively, install with [Composer](http://getcomposer.org).\n\nExamples\n========\n\nCodeIgniter Controller\n----------------------\n\nHere is a simple User controler which is showing a list of users.\n\nThis function allows you to pass various parameters in the URL to filter the user list.\n\nFor example the following URLs can be used\n\n* `http://website.com/users/list` - The basic list - show everything\n* `http://website.com/users/list/page/5` - Move to page 5 (e.g. if using pagination)\n* `http://website.com/users/list/newsletter/yes` - Only show users who are signed up to the newsletter\n* `http://website.com/users/list/role/admin` - Only show 'admin' users\n* `http://website.com/users/list/recent/yes` - Only show users who have logged in recently\n* `http://website.com/users/list/page/5/newsletter/yes` - A combination of only showing page 5 + users subscribed to the newsletter\n* `http://website.com/users/list/role/admin/recent/yes` - Another combination showing only 'admin' users who have loggged in recently\n* All of the above can be combined in any combination.\n\nThe example CodeIgniter controller would look something like this:\n\n\t\u003c?\n\tclass Users extends CI_Controller {\n\n\t\tfunction List() {\n\t\t\t$this-\u003eURLopts = new URLopts();\n\n\t\t\t// Setup various DB query parameters\n\t\t\t$offset = 0;\n\t\t\t$limit = 30;\n\t\t\t$where = array();\n\n\t\t\t$params = $this-\u003eURLopts-\u003eGet(); // Process this URL into an accessible array object of parameters\n\n\t\t\tif (isset($params['page'])) // Are we asking for a specific page (e.g. http://website.com/users/list/page/5)\n\t\t\t\t$offset = $limit * $params['page'];\n\n\t\t\tif (isset($params['newsletter']) \u0026\u0026 $params['newsletter']) // Are we only interested in users subscribed to a newsletter (e.g. http://website.com/users/list/newsletter/yes)\n\t\t\t\t$where['newsletter'] = 1;\n\n\t\t\tif (isset($params['role']) \u0026\u0026 $params['role']) // Are we only interested in users with a specific role (e.g. http://website.com/users/list/role/admin)\n\t\t\t\t$where['role'] = $params['role'];\n\n\t\t\tif (isset($params['recent']) \u0026\u0026 $params['recent']) // Are we only interested in users who have logged in recently (e.g. http://website.com/users/list/recent/yes)\n\t\t\t\t$where['lastlogin \u003e='] = strtotime('-1 ' . $params['recent']);\n\n\t\t\t$this-\u003eload-\u003eview('users/header');\n\t\t\t$this-\u003eload-\u003eview('users/list', array(\n\t\t\t\t'users' =\u003e $this-\u003eUser-\u003eGetAll($where, $limit, $offset), // This assumes you have a 'User' model with the function 'GetAll()'\n\t\t\t\t'limit' =\u003e $limit,\n\t\t\t\t'offset' =\u003e $offset,\n\t\t\t\t'params' =\u003e $params,\n\t\t\t));\n\t\t\t$this-\u003eload-\u003eview('users/footer');\n\t\t}\n\t}\n\n\nCodeIgniter Views\n-----------------\nThis library also provides ways to return a URL with various options turned off/on.\n\nFor example these functions can be placed in your view to return the current URL again with various options set:\n\n\t\u003c?=$this-\u003eURLopts-\u003eEdit('foo=bar')?\u003e\n\nThe above sets 'foo' to 'bar' in the URL. If the current URL was 'http://website.com/users/list' the above would return 'http://website.com/users/list/foo/bar'.\n\n\t\u003c?=$this-\u003eURLopts-\u003eEdit('+foo')?\u003e\n\nThe above sets 'foo' to '1' in the URL. If the current URL was 'http://website.com/users/list' the above would return 'http://website.com/users/list/foo/1'.\n\n\t\u003c?=$this-\u003eURLopts-\u003eEdit('-foo')?\u003e\n\nThe above removes 'foo' from the URL. If the current URL was 'http://website.com/users/list/foo/bar' the above would return 'http://website.com/users/list'.\n\nAn alternate syntax is also available:\n\n\t\u003c?=$this-\u003eURLopts-\u003eAdd('foo', 'bar')?\u003e\n\n\t\u003c?=$this-\u003eURLopts-\u003eRemove('foo')?\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhash-bang%2Furlopts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhash-bang%2Furlopts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhash-bang%2Furlopts/lists"}