Download the PHP package atk14/sluggish-router without Composer

On this page you can find all versions of the php package atk14/sluggish-router. 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 sluggish-router

SluggishRouter

Base class for ATK14 routers generating nice looking URLs with slugs

It can handle "detail" URLs for models that have method and static method . You can find both in the Atk14Catalog.

Basic usage

Router class:

<?php
// file: config/routers/articles_router.php
class ArticlesRouter extends SluggishRouter {

  var $patterns = [
    "en" => ["index" => "/articles/", "detail" => "/articles/<slug>/"],
    "cs" => ["index" => "/clanky/", "detail" => "/clanky/<slug>/"],
    "sk" => ["index" => "/sk/clanky/", "detail" => "/sk/clanky/<slug>/"],
  ];

  // var $model_class_name = "Article"; // by default determined automatically according to the router's class name
  // var $target_controller_name = "articles"; // by default determined automatically according to the router's class name
}

Loading router:

<?php
// file: config/routers/load.php
Atk14Url::AddRouter("ArticlesRouter"); // the default namespace ("")
Atk14Url::AddRouter("blog","ArticlesRouter"); // loading ArticlesRouter also into namespace blog

In a template:

{a controller="articles" action="detail" id=123}Here is the article{/a}<br>
{a controller="articles" action="index"}Show all articles{/a}

Rendered HTML:

<a href="/articles/why-is-the-atk14-so-cool/">Here is the article</a><br>
<a href="/articles/">Show all articles</a>

An easier way to set the routes:

<?php
// file: config/routers/articles_router.php
class ArticlesRouter extends SluggishRouter {

  var $patterns = [
    "en" => "articles", // same as ["index" => "/articles/", "detail" => "/articles/<slug>/"]
    "cs" => "clanky", //  same as ["index" => "/clanky/", "detail" => "/clanky/<slug>/"]
    "sk" => "sk/clanky", // same as ["index" => "/sk/clanky/", "detail" => "/sk/clanky/<slug>/"]
  ];
}

Setting only detail routes:

<?php
// file: config/routers/articles_router.php
class ArticlesRouter extends SluggishRouter {

  var $patterns = [
    "en" => "/articles/<slug>/", // same as ["detail" => "/articles/<slug>/"]
    "cs" => "/clanky/<slug>/", //  same as ["detail" => "/clanky/<slug>/"]
    "sk" => "/sk/clanky/<slug>/", // same as ["detail" => "/sk/clanky/<slug>/"]
  ];
}

Fallback route

A fallback route for all the unlisted languages can be specified using the asterisk symbol.

<?php
// file: config/routers/articles_router.php
class ArticlesRouter extends SluggishRouter {
  var $patterns = [
    "*" => ["index" => "/<lang>/articles/", "detail" => "/<lang>/articles/<slug>/"],
  ];
}

Installation

Use the Composer to install SluggishRouter.

cd path/to/your/project/
composer require atk14/sluggish-router

Testing

composer update --dev
cd test
../vendor/bin/run_unit_tests

Licence

SluggishRouter is free software distributed under the terms of the MIT license


All versions of sluggish-router with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 atk14/sluggish-router contains the following files

Loading the files please wait ....