1. PHP API Lab v2

Welcome

Welcome to Nutanix API Getting Started Lab (PHP) - v2

Getting Started

The Nutanix API App Labs will cover a couple of key points.

  • Creation of a simple application based on the Laravel PHP framework.
  • Creation of relevant views to display Prism information to the user.
  • Backend models and controllers to carry out the “real” work i.e. leverage the Nutanix REST APIs.
  • Scripts to create the interface between the front- and back-end parts of the application.

Note

Because this lab is written to be completed by those with little to no experience with Laravel/PHP or Nutanix APIs, it will step-through each part of the application being created. Experienced developers may wish to go over the API intro in the next section so that it can be integrated into their own applications.

This version of the lab is also an update to v1.1 published in 2018. Laravel 5.1 was used in that version, whereas this version will use Laravel 6.

Requirements

To successfully complete this app lab, you will need an environment that meets the following specifications.

  • An installation of PHP version 7.2 or later. For this lab, we will use the built-in PHP web server; there’s no requirement to install WAMP, MAMP, IIS etc. To check your PHP version, open a terminal or command prompt and enter the following command:

    php --version
    

    Note

    If you are installing PHP from source or selecting PHP components/libraries, please ensure you enable PHP-dom. This is required for correct Laravel operation.

    To check if PHP-dom is installed, the following command can be used. Look for dom in the results.

    php -m | head
    
  • PHP Composer. Install from the PHP Composer website, making sure you can run composer in the terminal after installation.

    composer
    
  • The code editor of your choice. We recommend Microsoft Visual Studio Code or Sublime Text 3.

  • A Nutanix cluster, running Acropolis 5.11 or later.

  • An instance of Prism Central version 5.11 or later, with your lab cluster registered against that instance.

Note

If your laptop or workstation is not yet setup for development, you may wish to complete the Nutanix Developer Marketing Dev Environment Setup 1.0 Lab, first.

Optional Components

In addition to the requirement components above, the following things are “nice to have”. They are not mandatory for these labs.

  • A Github account. This can be created by signing up directly through GitHub.
  • The GitHub Desktop application (available for Windows and Mac only).
  • Previous experience with PHP or related scripting/web technologies
  • Experience with the Laravel PHP framework
  • Postman, one of the most popular API testing tools available.

Cluster Details

This lab can be run in a couple of different ways. Primarily:

  • In an instructor-led environment, typically completed using Nutanix Frame. These sessions can be arranged with Nutanix directly, if required.
  • Self-paced, where access to a Nutanix cluster is the responsibility of the reader.

Get Started

With all that out of the way, let’s now start by looking at some of the conventions that will be used.

Back to Top