Download the PHP package nystudio107/routemap without Composer

On this page you can find all versions of the php package nystudio107/routemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package routemap

No Maintenance Intended

DEPRECATED

This 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.

The Craft CMS 3.x version of this plugin can be found here: craft-routemap and can also be installed via the Craft Plugin Store in the Craft CP.

Route Map plugin for Craft CMS

Returns a list of Craft/Vue/React route rules and entry & asset URLs for ServiceWorkers from Craft entries

Installation

To install Route Map, follow these steps:

  1. Download & unzip the file and place the routemap directory into your craft/plugins directory
  2. -OR- do a git clone https://github.com/nystudio107/routemap.git directly into your craft/plugins folder. You can then update it with git pull
  3. -OR- install with Composer via composer require nystudio107/routemap
  4. Install plugin in the Craft Control Panel under Settings > Plugins
  5. The plugin folder should be named routemap for Craft to see it. GitHub recently started appending -master (the branch name) to the name of the folder for zip file downloads.

Route Map works on Craft 2.4.x and Craft 2.5.x.

Route Map Overview

Route Map is a plugin to help bridge the routing gap between frontend technologies like Vue/React and Craft CMS. Using Route Map, you can define your routes in Craft CMS as usual, and use an XHR to get a list of the routes in JSON format for use in your Vue/React frontend (it converts blog/{slug} dynamic routes to /blog/:slug).

This allows you to create your routes dynamically in Craft CMS using the AdminCP, and have them translate automatically to your frontend framework of choice.

Route Map also assists with ServiceWorkers by providing a list of all of the URLs on your Craft CMS site, or just the specific sections you're interested in. You can limit the URLs returned via any ElementCriteriaModel attributes, and Route Map can even return a list of URLs to all of the Assets that a particular Entry uses (whether in Assets fields, or embedded in Matrix/Neo blocks).

This allows you, for instance, to have a ServiceWorker that will automatically pre-cache the latest 5 blog entries on your site, as well as any images displayed on those pages, so that they will work with offline browsing.

Route Map maintains a cache of each requested set of URLs for excellent performance for repeated requests. This cache is automatically cleared whenever entries are created or modified.

Configuring Route Map

There's nothing to configure.

Using Route Map via XHR

Route Rules

The controller API endpoint /admin/actions/routeMap/getAllRouteRules will return all of your website's route rules in an associative array. By default, they are in Craft CMS format (e.g.: blog/{slug}):

The format URL parameter allows you to specify either Craft | React | Vue format for your URL routes. For example, the controller API endpoint /admin/actions/routeMap/getAllRouteRules?format=Vue will return the same route rules above, but formatted for Vue (e.g.: blog/:slug):

Note that blog\/{slug} was changed to blog\/:slug. This allows you to easily map both static and dynamic Craft CMS routes to your router of choice.

If you want just the route rules for a particular section, you can use the controller API endpoint /admin/actions/routeMap/getSectionRouteRules?section=blog (note the required section parameter that specifies the Section handle you want):

You can also pass in the optional format parameter to get route rules from a specific section, in a particular format via the controller API endpoint /admin/actions/routeMap/getSectionRouteRules?section=blog&format=Vue

Entry URLs

The controller API endpoint /admin/actions/routeMap/getAllUrls will return a list of all of the URLs to all of the Entries on your website:

You can retrieve just the entries for a particular section via the controller API endpoint /admin/actions/routeMap/getSectionUrls?section=blog (note the required section parameter that specifies the Section handle you want):

Both of the above controller API endpoints support an optional attributes parameter that lets you pass in an array of ElementCriteriaModel attribute key/value pairs to be used to refine the Entries selected.

For instance, if you wanted just the most recent 5 Entries from the blog section, you'd use the controller API endpoint /admin/actions/routeMap/getSectionUrls?section=blog&attributes[limit]=5:

Or if you wanted the 5 oldest Entries from the blog section, you'd use the controller API endpoint /admin/actions/routeMap/getSectionUrls?section=blog&attributes[limit]=5&attributes[order]=postDate asc:

Entry URL Assets

The controller API endpoint /admin/actions/routeMap/getUrlAssetUrls?url=/blog/tags-gone-wild will return all of the image Assets from the Entry with the URI of /blog/tags-gone-wild, whether in Assets fields, or embedded in Matrix/Neo blocks (note the required url parameter that specifies the URL to the entry you want):

Either a full URL or a partial URI can be passed in via the url parameter.

By default, it only returns Assets of the type image but using the optional parameter assetTypes you can pass in an array of the types of Assets you want returned. For instance, if we wanted image, video, and pdf Assets returned, we'd use the controller API endpoint /admin/actions/routeMap/getUrlAssetUrls?url=/blog/tags-gone-wild&assetTypes[0]=image&assetTypes[1]=video&assetTypes[2]=pdf'.

Using Route Map in your Twig Templates

You can also access any of the aforementioned functionality from within Craft CMS Twig templates.

Route Rules

To get all of your website's route rules:

To specify the format that the route rules should be returned in, pass in either Craft | React | Vue:

To get route rules from only a specific section (such as blog, in this case), pass in the Section handle:

You can also pass in the optional format parameter to get route rules from a specific section, in a particular format:

Entry URLs

To get all of your website's public Entry URLs:

To refine the URLs returned, you can pass in optional ElementCriteriaModel attributes via key/value pairs:

or

To get URLs from just a specific Section:

To refine the URLs returned, you can pass in optional ElementCriteriaModel attributes via key/value pairs:

or

Entry URL Assets

To get all of the Asset URLs in a particular Entry (whether in Assets fields or embedded in Matrix/Neo blocks) by passing in a URL or URI to the entry:

By default, it returns only Assets of the type image. You can pass in an optional array of Asset types you want returned:

Using Route Map from your Plugins

The craft()->routeMap service gives you access to all of the functions mentioned above via your plugins.

Route Rules

To get all of your website's route rules:

To specify the format that the route rules should be returned in, pass in either Craft | React | Vue:

To get route rules from only a specific section (such as blog, in this case), pass in the Section handle:

You can also pass in the optional format parameter to get route rules from a specific section, in a particular format:

Entry URLs

To get all of your website's public Entry URLs:

To refine the URLs returned, you can pass in optional ElementCriteriaModel attributes via key/value pairs:

or

To get URLs from just a specific Section:

To refine the URLs returned, you can pass in optional ElementCriteriaModel attributes via key/value pairs:

or

Entry URL Assets

To get all of the Asset URLs in a particular Entry (whether in Assets fields or embedded in Matrix/Neo blocks) by passing in a URL or URI to the entry:

By default, it returns only Assets of the type image. You can pass in an optional array of Asset types you want returned:

Route Map Roadmap

Some things to do, and ideas for potential features:

Brought to you by nystudio107


All versions of routemap with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nystudio107/routemap contains the following files

Loading the files please wait ....