This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "your name", | |
"description":"a simple mini library demo app" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Psr\Http\Message\ServerRequestInterface as Request; | |
use \Psr\Http\Message\ResponseInterface as Response; | |
require '../vendor/autoload.php'; | |
$app = new \Slim\App(); | |
$app->get('/', function (Request $request, Response $response) { | |
$response->withStatus(200)->write("Welcome to the Adroit Library Demo."); | |
return $response; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "your name", | |
"description":"a simple mini library demo app", | |
"require": { | |
"slim/slim": "^3.0" | |
}, | |
"require-dev": { | |
"phpunit/phpunit": "^7" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use PHPUnit\Framework\TestCase; | |
class LibraryTestCase extends TestCase | |
{ | |
public function testLibraryGet() { | |
$this->assertTrue(true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Psr\Http\Message\ServerRequestInterface as Request; | |
use \Psr\Http\Message\ResponseInterface as Response; | |
require '../vendor/autoload.php'; | |
$app = new \Slim\App(); | |
function availableLibraryId($id) { | |
return (int)$id && $id > 0 && $id <= 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Library\App; | |
use \Psr\Http\Message\ServerRequestInterface as Request; | |
use \Psr\Http\Message\ResponseInterface as Response; | |
class LibraryRoute | |
{ | |
/** | |
* Stores an instance of the Slim application. | |
* | |
* @var \Slim\App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "your name", | |
"description":"a simple mini library demo app", | |
"require": { | |
"slim/slim": "^3.0" | |
}, | |
"require-dev": { | |
"phpunit/phpunit": "^7" | |
}, | |
"autoload": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '../vendor/autoload.php'; | |
// Run app | |
$app = (new Library\App\LibraryRoute())->get(); | |
$app->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Library\App\LibraryRoute; | |
use Slim\Http\Environment; | |
use Slim\Http\Request; | |
use PHPUnit\Framework\TestCase; | |
class LibraryTestCase extends TestCase | |
{ | |
protected $app; | |
public function setUp() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Library\App\LibraryRoute; | |
use Slim\Http\Environment; | |
use Slim\Http\Request; | |
use PHPUnit\Framework\TestCase; | |
class LibraryTestCase extends TestCase | |
{ | |
protected $app; | |
public function setUp() |
OlderNewer