Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SLIM and basic implementation using SWAGGER Editor

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.24k
    Comment on it

    Slim is a micro framework in PHP which is used to write powerful web applications and APIs.


    Slim is a simple framework that care for core necessities of a web application, receiving the HTTP request, dispatch the appropriate code and return the HTTP response as one microframework do.


    Slim framework also provide middle-ware, methods for HTTP caching and ability to use custom views to render a template.
    In slim, one can easliy do error handling and debug it.
    Slim have simple configuration.

     

    Use Slim using Swagger editor server code:

     

    1) Open an open example in swagger editor using below link:
     
      http://http://editor.swagger.io/#/

    2) Generate server code for slim in swagger editor and download it. Save the file in var/www/html/ folder.

    3) Extract the file. It should have composer.json. Install the composer.json file.
        
        composer install

     

    Now,  in the index.php file write the below code and check whether the set up is correct or not. The code is:
       

    $app->get('/', function ($request, $response, $args) {
            return $response->withStatus(200)->write('Slim is working!!!!!!');
        });


    NOTE: Dependencies are :
    1) Apache
    2) PHP 5.5 and above

    For making Slim Restfull Apis, while writing the code we can use different HTTP actions. You can check the below link for the different Http action.
        
      http://http://findnerd.com/list/view/Methods-in-REST-approach/18130/

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: