Download PDF by Paul Redmond: Lumen Programming Guide: Writing PHP Microservices, REST and

By Paul Redmond

Learn to write down test-driven microservices, leisure APIs, and net provider APIs with personal home page utilizing the Lumen micro-framework, from the now renowned Laravel relations. This booklet exhibits you the way checking out APIs may also help write bullet-proof internet software providers and microservices.

In the Lumen Programming Guide you are going to methods to use Lumen—a micro-framework by means of Laravel—to write bullet-proof APIs. Lumen is helping you write effective, maintainable APIs utilizing sleek program layout. you'll the right way to write fully-tested APIs and comprehend crucial Lumen options used to construct a fantastic starting place for writing API projects.

What you are going to Learn

  • Maintain your API's database constitution via integrated database migrations
  • Write checks with manufacturing facility facts in a try database
  • Respond with constant information output in JSON
  • Deal with Hypertext Preprocessor exceptions through the use of JSON responses
  • Create, learn, replace, and delete leisure resources
  • Represent version institutions in API responses
  • Build an effective beginning for writing exams with PHPUnit and Mockery
  • Validate facts

Who This ebook Is For
PHP builders with out Laravel event. just a uncomplicated realizing of HTTP and writing personal home page functions is required to get started.

Show description

Read or Download Lumen Programming Guide: Writing PHP Microservices, REST and Web Service APIs PDF

Similar object-oriented software design books

Download e-book for iPad: An Inductive Logic Programming Approach to Statistical by K. Kersting

During this e-book, the writer Kristian Kersting has made an attack on one of many toughest integration difficulties on the center of synthetic Intelligence study. This consists of taking 3 disparate significant parts of analysis and making an attempt a fusion between them. the 3 parts are: good judgment Programming, Uncertainty Reasoning and desktop studying.

Alan Shalloway's Design Patterns Explained - A New Perspective PDF

(Pearson schooling) textual content combining the rules of object-oriented programming with the facility of layout styles to create a brand new atmosphere for software program improvement. Stresses the significance of study and layout, displaying how styles can facilitate that approach. Softcover. DLC: Object-oriented equipment (Computer science).

Download PDF by Gregory D. Speegle: JDBC: Practical Guide for Java Programmers (The Practical

JDBC: useful consultant for Java Programmers is the fastest approach to achieve the abilities required for connecting your Java program to a SQL database. useful, tutorial-based insurance retains you targeted at the crucial initiatives and strategies, and incisive factors cement your realizing of the API good points you are going to use time and again.

Visual Languages for Interactive Computing: Definitions and by Fernando Ferri PDF

Visible languages are the defining section of interactive computing environments, but regardless of the speedy velocity of evolution of this area, major demanding situations stay. visible Languages for Interactive Computing: Definitions and Formalizations provides entire insurance of the issues and methodologies concerning the syntax, semantics, and ambiguities of visible languages.

Additional info for Lumen Programming Guide: Writing PHP Microservices, REST and Web Service APIs

Sample text

Eloquent will also populate the timestamp columns for you automatically when you create and update records. 27 CHAPTER 4 ■ STARTING THE BOOKS API Now that you have the migration ready, let’s run it (Listing 4-12). Listing 4-12. Running Your First Database Migration # vagrant@homestead:~/Code/bookr$ $ php artisan migrate Migrated: 2016_07_28_232137_create_books_table It seems to have worked! Check the database to be sure (Table 4-1). mysql> use bookr; mysql> show columns from books; Table 4-1. The Books Table Structure Field Type Key Default id int(10) unsigned PRI NULL title varchar(255) NULL description Text NULL author varchar(255) NULL created_at Timestamp 0000-00-00 00:00:00 updated_at Timestamp 0000-00-00 00:00:00 Success!

You are again back to green and you can move on to your next acceptance criterion, shown in Listing 5-10. Listing 5-10. Testing Failure When a Book Does Not Exist 46 47 48 49 50 51 52 53 54 55 56 57 /** @test **/ public function show_should_fail_when_the_book_id_does_not_exist() { $this ->get('/books/99999') ->seeStatusCode(404) ->seeJson([ 'error' => [ 'message' => 'Book not found' ] ]); } Next, let’s run the test to make sure it fails (Listing 5-11). Listing 5-11. Running PHPUnit After Writing the Test # vagrant@homestead:~/Code/bookr$ $ phpunit --filter=show_should_fail_when_the_book_id_does_not_exist There was 1 failure: 1) Tests\App\Http\Controllers\BooksControllerTest::show_should_fail_when_the_book_id_does_ not_exist Invalid JSON was returned from the route.

Registering the HelloMiddleware 66 67 68 69 70 71 72 $app->middleware([ App\Http\Middleware\RequestLogMiddleware::class ]); $app->routeMiddleware([ 'hello' => App\Http\Middleware\HelloMiddleware::class ]); The $app->routeMiddleware() method takes an associative array. The key hello is a shorthand reference to the middleware class; the shorthand key configures routes to use the middleware (Listing 2-19). Listing 2-19. Configuring Your Route to Use the HelloMiddleware 22 23 24 $app->get('/hello/{name}', ['middleware' => 'hello', function ($name) { return "Hello {$name}"; }]); You have changed the second parameter in $app->get() to an array.

Download PDF sample

Rated 4.42 of 5 – based on 11 votes