AltoRouter | Lightweight | REST library

 by   dannyvankooten PHP Version: 2.0.2 License: MIT

kandi X-RAY | AltoRouter Summary

kandi X-RAY | AltoRouter Summary

AltoRouter is a PHP library typically used in Web Services, REST applications. AltoRouter has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

AltoRouter is a small but powerful routing class, heavily inspired by klein.php.

            kandi-support Support

              AltoRouter has a medium active ecosystem.
              It has 1160 star(s) with 236 fork(s). There are 60 watchers for this library.
              It had no major release in the last 12 months.
              There are 22 open issues and 176 have been closed. On average issues are closed in 109 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of AltoRouter is 2.0.2

            kandi-Quality Quality

              AltoRouter has 0 bugs and 0 code smells.

            kandi-Security Security

              AltoRouter has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              AltoRouter code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              AltoRouter is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              AltoRouter releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.
              AltoRouter saves you 62 person hours of effort in developing the same functionality from scratch.
              It has 163 lines of code, 9 functions and 2 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed AltoRouter and discovered the below as its top functions. This is intended to give you an instant insight into AltoRouter implemented functionality, and help decide if they suit your requirements.
            • Match request parameters
            • Generate named route
            • Compile a route .
            • Map a route .
            • Adds a set of routes .
            • Sets the base path .
            • Get routes .
            • Add the match types .
            Get all kandi verified functions for this library.

            AltoRouter Key Features

            No Key Features are available at this moment for AltoRouter.

            AltoRouter Examples and Code Snippets

            No Code Snippets are available at this moment for AltoRouter.

            Community Discussions


            How to call controller->method with alto router
            Asked 2021-May-31 at 12:04

            I'm trying to learn how to use alto router and what I want i'ts "pretty simple".


            • "/" should call "AppController->index()"
            • "/profil" should call "ProfilController->profil()"
            • /profil/1" should call "ProfilController->profilById()


            This is what I've tried so far:



            Answered 2021-May-31 at 12:04

            I found the solution:

            Solution 1 : Put all routes in index.php




            $pdo returns NULL from a method after implementing a router
            Asked 2020-Mar-19 at 07:50

            I'm spending hours trying to solve this problem. My website worked well but i needed to change some ugly URLs.

            I tried to implement a router (AltoRouter) and everything worked just fine after some changes until i got this error:

            Fatal error: Uncaught Error: Call to a member function prepare() on null in foldername line X

            I have a basic MVC, the Model looks like this:

            Basically $pdo is null in this method: (And every single method in that class aswell)



            Answered 2020-Mar-19 at 00:05

            @AbraCadaver already explained you the reason, why you encountered the specified prolem. So, in this regard, all credits go to him.

            Note that, in a correct implementation of an MVC application, a database connection is used only by the components of the model layer.

            So, having your current design in mind, the correct solution is to pass the $pdo instance to each model object created in the scope of the matched route's target.

            So, UsersModel should receive $pdo as dependency:


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install AltoRouter

            You need PHP >= 5.6 to use AltoRouter, although we highly recommend you use an officially supported PHP version that is not EOL.
            Install AltoRouter
            Rewrite all requests to AltoRouter
            Map your routes
            Match requests
            Process the request your preferred way


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone dannyvankooten/AltoRouter

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with AltoRouter

            Consider Popular REST Libraries


            by public-apis


            by typicode


            by iptv-org


            by tiangolo


            by beego

            Try Top Libraries by dannyvankooten


            by dannyvankootenPHP


            by dannyvankootenGo


            by dannyvankootenPHP


            by dannyvankootenGo


            by dannyvankootenPHP