yii2-rest-api | Yii 2 REST API Project Template | Web Framework library

 by   forecho PHP Version: v0.0.6 License: BSD-3-Clause

kandi X-RAY | yii2-rest-api Summary

kandi X-RAY | yii2-rest-api Summary

yii2-rest-api is a PHP library typically used in Server, Web Framework applications. yii2-rest-api has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Yii 2 REST API Project Template
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              yii2-rest-api has a low active ecosystem.
              It has 30 star(s) with 9 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 0 open issues and 1 have been closed. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of yii2-rest-api is v0.0.6

            kandi-Quality Quality

              yii2-rest-api has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              yii2-rest-api is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              yii2-rest-api releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.
              yii2-rest-api saves you 450 person hours of effort in developing the same functionality from scratch.
              It has 1063 lines of code, 62 functions and 35 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed yii2-rest-api and discovered the below as its top functions. This is intended to give you an instant insight into yii2-rest-api implemented functionality, and help decide if they suit your requirements.
            • Add authentication handlers .
            • Create new user
            • Before sending event
            • Set cookie key .
            • Convert enum value to enum value
            • Overrides the default fields
            • Create safe table
            • Error action .
            • Login action .
            • Bootstrap application events .
            Get all kandi verified functions for this library.

            yii2-rest-api Key Features

            No Key Features are available at this moment for yii2-rest-api.

            yii2-rest-api Examples and Code Snippets

            Yii 2 REST API Project Template,Use
            PHPdot img1Lines of Code : 11dot img1License : Permissive (BSD-3-Clause)
            copy iconCopy
            # create a user via: POST /v1/join
            curl -X POST -H "Content-Type: application/json" -d '{"username":"demo","email":"demo@email.com","password":"pass123"}' http://localhost:8000/v1/join
            # should return like: {"code":0,"data":{"username":"demo","email"  
            Yii 2 REST API Project Template,INSTALLATION,Install via Composer
            PHPdot img2Lines of Code : 6dot img2License : Permissive (BSD-3-Clause)
            copy iconCopy
            composer create-project --prefer-dist forecho/yii2-rest-api 
            cd 
            cp .env.example .env
            php yii generate/key # optional 
            chmod 777 -R runtime/
            
            http://localhost//web/
              
            Yii 2 REST API Project Template,INSTALLATION,Install from GitHub
            PHPdot img3Lines of Code : 5dot img3License : Permissive (BSD-3-Clause)
            copy iconCopy
            git clone xxxx
            cd 
            cp .env.example .env
            chmod 777 -R runtime/
            
            http://localhost//web/
              

            Community Discussions

            Trending Discussions on yii2-rest-api

            QUESTION

            Yii2 Rest API user authentication
            Asked 2018-Oct-29 at 12:03

            I am implementing Rest API in yii2. I want to authenticate the user using access token. I have referred various SO answers as follows

            But I m not clear, which authentication method I should use and how I will get user identity.

            I have created findIdentityByAccessToken() method in my user identity class as suggested in Yii2 Rest guide .

            Below is the behaviour implemented in my controller

            ...

            ANSWER

            Answered 2017-Jan-05 at 15:23

            Simple answer there's more than one possibility to implement this behavior.

            Both HttpBearerAuth and HttpBasicAuth can use the findIdentityByAccessToken() methode when configured correctly. the behavior you should use depends on the way you want users to authenticate themselves.

            if you read the documentation of HttpBasisAuth HttpBasicAuth you'll see

            The default implementation of HttpBasicAuth uses the loginByAccessToken() method of the user application component and only passes the user name. This implementation is used for authenticating API clients.

            loginByAccesToken will invoke the findIdentityByAccesToken methode You can manipulate this behavior by defining a closure in the auth attribute see auth attribute.

            HttpBeareAuth almost does the same. it also implements the loginByAccessToken

            So what make the two different from each other? simple the location where the get the data from. where HttpBasicAuth expects that client has set the basic header example header('Authorization: Basic '. base64_encode("user:password")); (PHP has build in support for this see: http://php.net/manual/en/features.http-auth.php)

            the HttpBearerAuth expects that the header is defined as the following header('Authorization: Bearer '. $token);

            So the solution you should use depends on the way you want users/clients to authenticate themselves. you could also use the QueryParamAuth which gives the users the possibility to authenticate themselves whit a GET param see queryparamauth

            And if you want to use a custom header let's say X-API-Token create your own custom class that implements the AuthMethod interface see AuthMethod

            Hope this helps

            Source https://stackoverflow.com/questions/41480771

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

            Vulnerabilities

            No vulnerabilities reported

            Install yii2-rest-api

            If you do not have Composer, you may install it by following the instructions at getcomposer.org.
            Accessing Use this template Create a new repository from yii2-rest-api.
            Update your vendor packages. Run the installation triggers (creating cookie validation code).
            Minimum required Docker engine version 17.04 for development (see Performance tuning for volume mounts)
            The default configuration uses a host-volume in your home directory .docker-composer for composer caches

            Support

            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

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link