{"id":21429372,"url":"https://github.com/nystudio107/pathtools","last_synced_at":"2026-03-11T16:03:29.726Z","repository":{"id":25288280,"uuid":"28714216","full_name":"nystudio107/pathtools","owner":"nystudio107","description":"DEPRECATED This twig plugin for the Craft CMS brings convenient path \u0026 url manipulation functions \u0026 filters to your Twig templates.","archived":false,"fork":false,"pushed_at":"2019-01-01T23:26:06.000Z","size":12,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-01T12:57:09.501Z","etag":null,"topics":["craft-plugin","craftcms","path"],"latest_commit_sha":null,"homepage":"","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/nystudio107.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-02T13:37:10.000Z","updated_at":"2023-12-13T00:23:40.000Z","dependencies_parsed_at":"2022-08-24T00:20:59.270Z","dependency_job_id":null,"html_url":"https://github.com/nystudio107/pathtools","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fpathtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fpathtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fpathtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fpathtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nystudio107","download_url":"https://codeload.github.com/nystudio107/pathtools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225970889,"owners_count":17553411,"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":["craft-plugin","craftcms","path"],"created_at":"2024-11-22T22:17:28.183Z","updated_at":"2025-12-17T21:04:33.672Z","avatar_url":"https://github.com/nystudio107.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n\n# DEPRECATED\n\nThis Craft CMS 2.x plugin is no longer supported, but it is fully functional, and you may continue to use it as you see fit. The license also allows you to fork it and make changes as needed for legacy support reasons.\n\nThe Craft CMS 3.x version of this plugin can be found here: [craft-pathtools](https://github.com/nystudio107/craft-pathtools) and can also be installed via the Craft Plugin Store in the Craft CP.\n\n# PathTools twig plugin for Craft\n\nThis twig plugin for the Craft CMS brings convenient path \u0026 url manipulation functions \u0026 filters to your Twig templates.\n\nRelated: [PathTools for Craft 3.x](https://github.com/nystudio107/craft3-pathtools)\n\n## Installation\n\nTo install PathTools, follow these steps:\n\n1. Download \u0026 unzip the file and place the `pathtools` directory into your `craft/plugins` directory\n2.  -OR- do a `git clone https://github.com/khalwat/pathtools.git` directly into your `craft/plugins` folder.  You can then update it with `git pull`\n3. Install plugin in the Craft Control Panel under Settings \u003e Plugins\n4. The plugin folder should be named `pathtools` for Craft to see it.  GitHub recently started appending `-master` (the branch name) to the name of the folder for zip file downloads.\n\n## Usage\n\nAll of the functionality offered by PathTools can be used either as a filter, e.g.:\n\n```\n{{ myAsset.url | basename }}\n```\n\nOr as a function, e.g.:\n\n```\n{% set myBaseName = basename(myAsset.url) %}\n```\n## php Wrapper Functions\n### pathinfo\nWrapper for the php pathinfo() function -- \u003chttp://php.net/manual/en/function.pathinfo.php\u003e\n### basename\nWrapper for the php basename() function -- \u003chttp://php.net/manual/en/function.basename.php\u003e\n### dirname\nWrapper for the php dirname() function -- \u003chttp://php.net/manual/en/function.dirname.php\u003e\n### parse_url\nWrapper for the php parse_url() function -- \u003chttp://php.net/manual/en/function.parse-url.php\u003e\n### parse_str\nWrapper for the php parse_str() function -- \u003chttp://php.net/manual/en/function.parse-str.php\u003e\n## Utility Functions\n### swap_extension\nCan be passed either a path or a url, and it will return the path or url with the filename extension changed, e.g.:\n\n```\n\u003csource src=\"{{ myAsset.url | swap_extension('mp4') }}\" type='video/mp4' /\u003e\n\u003csource src=\"{{ myAsset.url | swap_extension('webm') }}\" type='video/webm' /\u003e\n\n```\nFor ``myAsset.url`` = ``http://www.coolvids.com/content/vids/MyCoolVid.mp4`` the output would be:\n\n```\n\u003csource src=\"http://www.coolvids.com/content/vids/MyCoolVid.mp4\" type='video/mp4' /\u003e\n\u003csource src=\"http://www.coolvids.com/content/vids/MyCoolVid.webm\" type='video/webm' /\u003e\n\n```\n\n### swap_directory\nCan be passed either a path or a url, and it will return the path or url with the directory path changed, e.g.:\n\n```\n\u003cimg src=\"{{ myAsset.url | swap_directory('/over/there') }}\" /\u003e\n\n```\nFor ``myAsset.url`` = ``http://www.coolvids.com/not/here/rock.pdf`` the output would be:\n\n```\n\u003cimg src=\"http://www.coolvids.com/over/there/rock.pdf\" /\u003e\n\n```\n### append_suffix\nCan be passed either a path or a url, and it will return the path or url with the suffix appended to the filename, e.g.:\n\n```\n\u003cimg src=\"{{ myAsset.url | append_suffix('@2x') }}\" /\u003e\n\n```\nFor ``myAsset.url`` = ``http://www.coolvids.com/img/ux/search.png`` the output would be:\n\n```\n\u003cimg src=\"http://www.coolvids.com/img/ux/search@2x.png\" /\u003e\n\n```\n\n## Changelog\n\n### 1.0.2 -- 2016.08.04\n\n* [Added] Added the parse_str() function\n* [Improved] Updated the README.md\n\n### 1.0.1 -- 2015.11.23\n\n* [Added] Added support for Craft 2.5 new plugin features\n* [Improved] Updated the README.md\n\n### 1.0.0 -- 1/2/2015\n\n* Initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnystudio107%2Fpathtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnystudio107%2Fpathtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnystudio107%2Fpathtools/lists"}