{"id":18080820,"url":"https://github.com/joanrodas/plubo-routes","last_synced_at":"2025-04-12T14:33:05.625Z","repository":{"id":37821430,"uuid":"478658909","full_name":"joanrodas/plubo-routes","owner":"joanrodas","description":"Create custom WordPress routes and redirects, restrict access by roles and/or capabilities. Routes made simple","archived":false,"fork":false,"pushed_at":"2025-04-03T23:51:10.000Z","size":246,"stargazers_count":13,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T00:27:49.474Z","etag":null,"topics":["composer","composer-package","plugin","rewrite-rules","routes","routing","wordpress","wordpress-php-library","wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://plubo.dev","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joanrodas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"joanrodas","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-04-06T17:22:35.000Z","updated_at":"2025-03-09T16:25:00.000Z","dependencies_parsed_at":"2023-11-27T21:27:57.994Z","dependency_job_id":"6391a337-891b-4d8f-821f-c60ecc809328","html_url":"https://github.com/joanrodas/plubo-routes","commit_stats":{"total_commits":100,"total_committers":3,"mean_commits":"33.333333333333336","dds":"0.16000000000000003","last_synced_commit":"d72fa54c4c9545ef3ab5123f76847cd1c5daac43"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanrodas%2Fplubo-routes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanrodas%2Fplubo-routes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanrodas%2Fplubo-routes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanrodas%2Fplubo-routes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joanrodas","download_url":"https://codeload.github.com/joanrodas/plubo-routes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581336,"owners_count":21128148,"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":["composer","composer-package","plugin","rewrite-rules","routes","routing","wordpress","wordpress-php-library","wordpress-plugin"],"created_at":"2024-10-31T13:10:34.650Z","updated_at":"2025-04-12T14:33:05.602Z","avatar_url":"https://github.com/joanrodas.png","language":"PHP","funding_links":["https://ko-fi.com/joanrodas"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src='https://github.com/joanrodas/plubo-docs/blob/main/src/.vuepress/public/images/plubo-routes-banner.png?raw=true' alt='Plubo Routes' /\u003e\n\u003c/p\u003e\n\n[![GitHub stars](https://img.shields.io/github/stars/joanrodas/plubo-routes?style=for-the-badge)](https://github.com/joanrodas/plubo-routes/stargazers)\n![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability-percentage/joanrodas/plubo-routes?style=for-the-badge)\n\nWordPress routes made simple.\n\n\n✔️  No need to write rewrite rules and tags manually\\\n✔️  Automatically flush rewrite rules when the routes change\\\n✔️  Custom redirects and action routes\\\n✔️  Easily extendable with hooks\\\n✔️  Easy to use with Sage 10\n\n\n\u003cbr/\u003e\n\n## Getting started\n\n`composer require joanrodas/plubo-routes`\n\n\u003e You can also install Plubo Routes as a standalone WordPress plugin, simply downloading the zip and placing it in the plugins folder.\n\n\u003cbr/\u003e\n\n[Read the Docs](https://www.plubo.dev/docs/routing/)\n\n\u003cbr\u003e\n\n## Adding new routes\n\nThere are different types of routes:\n\n- [Route (template)](https://www.plubo.dev/docs/routing/)\n- [RedirectRoute](https://www.plubo.dev/docs/routing/redirect-routes.html)\n- [ActionRoute](https://www.plubo.dev/docs/routing/action-routes.html)\n- [PageRoute](https://www.plubo.dev/docs/routing/page-routes.html)\n\n\u003cbr\u003e\n\n## How to add a new route\n\nYou can add new routes using the following filter:\n\n```php\nPluboRoutes\\RoutesProcessor::init();\n\nadd_filter( 'plubo/routes', array($this, 'add_routes') );\npublic function add_routes( $routes ) {\n    //Your routes\n    return $routes;\n}\n```\n\n\u003cbr\u003e\n\n## Basic routes\n\nBasic routes take 3 parameters:\n\n| Parameter  | Type |\n| ------------- | ------------- |\n| **Route Path**  | String  |\n| **Template file name**  | String \\| Callable  |\n| **Config**  | Array (optional)  |\n\nExamples:\n\n```php\nuse PluboRoutes\\Route\\Route;\n\nadd_filter( 'plubo/routes', array($this, 'add_routes') );\npublic function add_routes( $routes ) {\n    $routes[] = new Route('clients/list', 'template_name');\n\n    //SAGE 10 example\n    $routes[] = new Route(\n        'dashboard/{subpage:slug}',\n        function($matches) {\n            $subpage = 'dashboard/' . $matches['subpage'];\n            return locate_template( app('sage.finder')-\u003elocate($subpage) );\n        },\n        [\n            'name' =\u003e 'my-route'\n        ]\n    );\n    return $routes;\n}\n```\n\n\u003cbr\u003e\n\n## Available syntax\n\nYou can use the format ***{variable_name:type}*** with any of the available types:\n\n* number (numbers only)\n* word (a-Z only)\n* slug (a valid WordPress slug)\n* date (yyyy-mm-dd date)\n* year (4 digits)\n* month (01-12)\n* day (01-31)\n* digit (single digit 0-9)\n* jwt (JWT token)\n* ip (IPv4)\n\n\u003e You can also use custom regex patterns using the format ***{variable_name:regex_pattern}*** like ***{author:([a-z0-9-]+)}***\n\n\u003cbr\u003e\n\n## Changing general template path\n\nBy default, Plubo Routes will search the template inside your theme, but you can use a hook to chenge the default path.\n\nIf you use Sage 10, you could add something like this:\n\n```php\nadd_filter( 'plubo/template', function($template) {\n    return app('sage.finder')-\u003elocate($template);\n});\n```\n\n\u003cbr\u003e\n\n## Custom Actions\n\nNamed routes provide a hook to execute your custom actions:\n\n```php\nadd_action('plubo/route_{route_name}', function($matches) {\n    //Do something\n});\n```\n\n\u003cbr\u003e\n\n## Contributions\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=for-the-badge)](https://github.com/joanrodas/plubo-routes/issues)\n[![GitHub issues](https://img.shields.io/github/issues/joanrodas/plubo-routes?style=for-the-badge)](https://github.com/joanrodas/plubo-routes/issues)\n[![GitHub license](https://img.shields.io/github/license/joanrodas/plubo-routes?style=for-the-badge)](https://github.com/joanrodas/plubo-routes/blob/main/LICENSE)\n\n\nFeel free to contribute to the project, suggesting improvements, reporting bugs and coding.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoanrodas%2Fplubo-routes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoanrodas%2Fplubo-routes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoanrodas%2Fplubo-routes/lists"}