Search code examples
javascriptphprestnette

Nette PHP framework and RESTful API with token authentication


Is Nette PHP framework is suitable for creation of RESTful API in PHP (for client JavaScript application), I cannot find a proper documentation apart IAuthenticator

  • Does Nette offer support RESTful? If no, does exist some stable "extensions"?
  • Does Nette offer support for token authentication? I notice cookies is the default using SimpleAuthetication.

Solution

  • I have used drahak/Restful long time ago. Last commit was 2 months ago so you should not have any problems. It provides you with more advanced router, OAuth2 and another tools to help you with building your API.

    $router[] = new CrudRoute('api/v1/<presenter>/<id>/[<relation>[/<relationId>]]', 'Articles');
    

    Also there was workshop on #posobota. Sources from API workshop can be found in fprochazka/workshop-rest-api-sandbox repository on GitHub.

    Let me know if it works fine for you!