ap-lib / routing-cache
Caching of an unchanging routing index is typically prepared on one computer and used on another.
Installs: 17
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ap-lib/routing-cache
Requires
- php: ^8.3
- ap-lib/routing: dev-main
Requires (Dev)
- phpunit/phpunit: 10.5.*
This package is auto-updated.
Last update: 2025-09-18 00:18:40 UTC
README
Caching of an unchanging routing index is typically prepared on one computer and used on another.
Installation
composer require ap-lib/routing-cache
Features
- Interface for saving and loading arrays what include links to classes to full related code
- Implementation for saving and loading arrays to a PHP file
Requirements
- PHP 8.3 or higher
Getting Started
// make routing $routing = new Hashmap(); // setup index $index = $routing->getIndexMaker(); $index->addEndpoint(Method::GET, "/", new Endpoint( [MainController::class, "handlerRoot"] )); $index->addEndpoint(Method::GET, "/hello", new Endpoint( [MainController::class, "handlerHelloName"] )); // Set up the cache object (in this case, it's just a filename) $cache = new PhpFileRoutingCache("data.php"); // Store the index in the cache $cache->set($index); // Retrieve the array to init routing index from the cache $retrieved_array = $cache->get();