Skip to content

Releases: splashsky/simplerouter

🕷️ v2.4.6 - BasePath and Tokenize Bugfix

23 Dec 15:31
Compare
Choose a tag to compare

See #12 for what this bugfix corrects - the TLDR is that there was an issue processing/tokenizing the basepath if it was an empty string. This was fixed relatively easy by making the run() method first trim the basepath and then pass it directly to tokenize(). You can now properly use an empty basepath!

v2.4.5 - 🔧 One last time!

22 Jul 18:10
Compare
Choose a tag to compare
🔧 One more namespace fix!

v2.4.4 - 🔧 Fix package for Composer

22 Jul 17:58
Compare
Choose a tag to compare

I guess I got the namespacing wrong for Composer, which meant you couldn't easily use this in a project. This should be fixed now!

v2.4.3 - route prefix group + improvements!

16 Jul 18:10
f85ca76
Compare
Choose a tag to compare

👋 Aloha! We had a couple feature/improvement bumps and a few bug/misc fixes since the last release, so this one should be pretty stacked.

  • Added route grouping, starting with route prefixes!
  • Cleaned up routing and basePath/root route handling via new route trimming
  • Fixed the route parameter constraint overlap bug!

Route Prefixes

As mentioned back in #3 and #10, we wanted a way to serve a specific "base path" without another entrypoint/router. To do this, we came up with a simple but clever solution; route grouping! Similar to how Laravel's routing works, you only need to provide a prefix and a function that registers new routes!

Router::prefix('api', function () {
    Router::get('/foo', function () { return "foo"; });

    Router::get('/bar/{name}', function ($name) {
        return "$name is at the bar.";
    })->with('name', '[A-Za-z]+');
});

Have fun with it!

v2.2.0 - improve tokenize speed

15 Jul 22:29
c45aed8
Compare
Choose a tag to compare

See #7 for this release. The goal is to make parsing the URIs as efficient as we possibly can! 😄

v2.1.0 - route parameter constraints!

15 Jul 22:02
2366121
Compare
Choose a tag to compare

👋🏻 Aloha! Quick release here! After adding new route parameters (v2.0.0) I needed to allow for custom RegEx to be used if a user wanted to. You can very easily define custom constraints via the new ->with() chain method! See #5 for an example.

Have fun! 😄

v2.0.0 - new route parameters!

15 Jul 19:50
Compare
Choose a tag to compare

Aloha! Here's the first "major" version bump!

Route parameters have changed! Now, instead of writing RegEx in your routes, SimpleRouter will handle it for you. Here's an example:

// Old route parameters
Router::get('/hello/([A-Za-z0-9_]+)/age/([0-9]+)', function ($name, $age) {
    return "Hello $age yo named $name!";
});

// New route parameters
Router::get('/hello/{n}/age/{a}', function ($name, $age) {
    return "Hello $age yo named $name!";
});

This super-simplifies your routing. The next feature planned is to allow you to still apply a RegEx constraint to each parameter, so that you can still control what gets passed through. Look forward to it!

Allow me to explain how versioning will work for this package going forward; any changes that require you to change your code to continue using the package will be a "major" version change. This will remain the case even if we hit v113.2.4. The minor version updates will be additional features or under-the-hood improvements. Bug fixes are in the third space as expected, except if fixes require breaking userland code.

v1.0.0 - new fork!

14 Jul 21:24
Compare
Choose a tag to compare

This is simply to release the current code base officially under the new fork. It's been uploaded to Packagist and so is also available via Composer. All functionality is the same as before, but we're starting at version 1.0.0!