100% found this document useful (3 votes)
74 views

Lumen Programming Guide Writing PHP Microservices REST and Web Service APIs 1st Edition Paul Redmond (Auth.) All Chapters Instant Download

APIs

Uploaded by

taacahajwi95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
74 views

Lumen Programming Guide Writing PHP Microservices REST and Web Service APIs 1st Edition Paul Redmond (Auth.) All Chapters Instant Download

APIs

Uploaded by

taacahajwi95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Lumen Programming Guide Writing PHP


Microservices REST and Web Service APIs 1st
Edition Paul Redmond (Auth.)

https://textbookfull.com/product/lumen-
programming-guide-writing-php-microservices-rest-
and-web-service-apis-1st-edition-paul-redmond-
auth/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

PHP Web Services APIs for the Modern Web 2nd Edition Lorna
Jane Mitchell

https://textbookfull.com/product/php-web-services-apis-for-the-modern-
web-2nd-edition-lorna-jane-mitchell/

textbookfull.com

Integrating Web Services with OAuth and PHP A php


architect Guide 1st Edition Matthew Frost

https://textbookfull.com/product/integrating-web-services-with-oauth-
and-php-a-php-architect-guide-1st-edition-matthew-frost/

textbookfull.com

PHP 8 Quick Scripting Reference A Pocket Guide to PHP Web


Scripting Third Edition Mikael Olsson

https://textbookfull.com/product/php-8-quick-scripting-reference-a-
pocket-guide-to-php-web-scripting-third-edition-mikael-olsson/

textbookfull.com

Computational Science ICCS 2018 18th International


Conference Wuxi China June 11 13 2018 Proceedings Part III
Yong Shi
https://textbookfull.com/product/computational-science-iccs-2018-18th-
international-conference-wuxi-china-june-11-13-2018-proceedings-part-
iii-yong-shi/
textbookfull.com
Tautai: S■moa, World History, and the Life of Ta’isi O. F.
Nelson Patricia O’Brien

https://textbookfull.com/product/tautai-samoa-world-history-and-the-
life-of-taisi-o-f-nelson-patricia-obrien/

textbookfull.com

Happy Orchid Help it Flower Watch it Flourish First


American Edition. Edition Sara Rittershausen. Peter Bull

https://textbookfull.com/product/happy-orchid-help-it-flower-watch-it-
flourish-first-american-edition-edition-sara-rittershausen-peter-bull/

textbookfull.com

This Land Is Our Land An Immigrant s Manifesto Suketu


Mehta

https://textbookfull.com/product/this-land-is-our-land-an-immigrant-s-
manifesto-suketu-mehta/

textbookfull.com

Belonging Identity Time and Young People s Engagement in


the Middle Years of School Seth Brown

https://textbookfull.com/product/belonging-identity-time-and-young-
people-s-engagement-in-the-middle-years-of-school-seth-brown/

textbookfull.com

Professional Communication: Consultancy, Advocacy,


Activism Louise Mullany

https://textbookfull.com/product/professional-communication-
consultancy-advocacy-activism-louise-mullany/

textbookfull.com
Crop Rotation An Approach to Secure Future Food Samiha
Ouda

https://textbookfull.com/product/crop-rotation-an-approach-to-secure-
future-food-samiha-ouda/

textbookfull.com
Lumen
Programming
Guide
Writing PHP Microservices, REST and
Web Service APIs

Paul Redmond
Lumen
Programming Guide
Writing PHP Microservices, REST
and Web Service APIs

Paul Redmond
Lumen Programming Guide: Writing PHP Microservices, REST and Web Service APIs
Paul Redmond
Phoenix, Arizona
USA
ISBN-13 (pbk): 978-1-4842-2186-0 ISBN-13 (electronic): 978-1-4842-2187-7
DOI 10.1007/978-1-4842-2187-7
Library of Congress Control Number: 2016953766
Copyright © 2016 by Paul Redmond
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director: Welmoed Spahr
Lead Editor: Steve Anglin
Technical Reviewer: Jacob Jensen
Editorial Board: Steve Anglin, Pramila Balan, Laura Berendson, Aaron Black, Louise Corrigan,
Jonathan Gennick, Robert Hutchinson, Celestin Suresh John, Nikhil Karkal, James Markham,
Susan McDermott, Matthew Moodie, Natalie Pao, Gwenan Spearing
Coordinating Editor: Mark Powers
Copy Editor: Mary Behr
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Cover image designed by Freepik
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street,
6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a
Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our Special
Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.
Any source code or other supplementary materials referenced by the author in this text are available to
readers at www.apress.com/9781484221860. For detailed information about how to locate your book’s source
code, go to www.apress.com/source-code/. Readers can also access source code at SpringerLink in the
Supplementary Material section for each chapter.
Printed on acid-free paper
To Bernadette
Contents at a Glance

About the Author ..................................................................................................... xi


About the Technical Reviewer ............................................................................... xiii
Acknowledgments ...................................................................................................xv
Introduction ...........................................................................................................xvii

■Chapter 1: Installing Lumen .................................................................................. 1


■Chapter 2: Hello Lumen ......................................................................................... 7
■Chapter 3: Creating the Book Application ........................................................... 17
■Chapter 4: Starting the Books API ....................................................................... 23
■Chapter 5: Creating, Reading, Updating, and Deleting Books .............................. 33
■Chapter 6: Responding to Errors ......................................................................... 65
■Chapter 7: Leveling Up Responses ...................................................................... 89
■Chapter 8: Validation ......................................................................................... 125
■Chapter 9: Authors ............................................................................................ 137
■Chapter 10: The /authors API Resource ............................................................ 165
■Chapter 11: Book Bundles ................................................................................. 201
■Chapter 12: Ratings ........................................................................................... 219
■Appendix: Where to Go From Here ..................................................................... 243

Index ..................................................................................................................... 245

v
Contents

About the Author ..................................................................................................... xi


About the Technical Reviewer ............................................................................... xiii
Acknowledgments ...................................................................................................xv
Introduction ...........................................................................................................xvii

■Chapter 1: Installing Lumen .................................................................................. 1


Homestead ....................................................................................................................... 1
Mac OSX ........................................................................................................................... 2
Linux ................................................................................................................................. 3
Red Hat/CentOS ...................................................................................................................................... 4
Debian/Ubuntu ........................................................................................................................................ 5

Windows ........................................................................................................................... 6
Conclusion ........................................................................................................................ 6
■Chapter 2: Hello Lumen ......................................................................................... 7
Setting Up a New Project ................................................................................................. 7
Routes .............................................................................................................................. 9
The Hello World Route .......................................................................................................................... 10
Route Parameters ................................................................................................................................. 10

Middleware and Responses ........................................................................................... 11


Global Middleware ................................................................................................................................ 11
Route Middleware................................................................................................................................. 13

vii
■ CONTENTS

The Request and Response Objects ............................................................................... 14


The Request.......................................................................................................................................... 15
The Response ....................................................................................................................................... 15

Onward ........................................................................................................................... 16
■Chapter 3: Creating the Book Application ........................................................... 17
Building Something Amazing ......................................................................................... 17
Environment Setup ......................................................................................................... 19
Checking Unit Tests ........................................................................................................ 21
Setup Complete .............................................................................................................. 22
■Chapter 4: Starting the Books API ....................................................................... 23
Creating the First Endpoint............................................................................................. 23
Setting Up Models and Seed Data .................................................................................. 26
Eloquent Books .............................................................................................................. 30
Success .......................................................................................................................... 32
■Chapter 5: Creating, Reading, Updating, and Deleting Books .............................. 33
Requesting an Individual Book ....................................................................................... 33
Creating a New Book ...................................................................................................... 41
Updating an Existing Book ............................................................................................. 49
Deleting Books ............................................................................................................... 53
Conclusion ...................................................................................................................... 63
■Chapter 6: Responding to Errors ......................................................................... 65
Test Database ................................................................................................................. 65
Model Factories .................................................................................................................................... 66
Factories in Tests .................................................................................................................................. 66

Better Error Responses .................................................................................................. 69


Framework Exception Handling ............................................................................................................ 70
JSON Exceptions .................................................................................................................................. 72

Testing the Exception Handler ........................................................................................ 74


Conclusion ...................................................................................................................... 88
viii
■ CONTENTS

■Chapter 7: Leveling Up Responses ...................................................................... 89


Introducing Fractal ......................................................................................................... 89
First Version of API Response Formatting ...................................................................... 90
The Fractal Response Class ........................................................................................... 97
The Book Transformer .......................................................................................................................... 97
The Fractal Response Class................................................................................................................ 101

Fractal Response Service ............................................................................................. 111


Integrating the Fractal Response Service .................................................................... 114
Conclusion .................................................................................................................... 124
■Chapter 8: Validation ......................................................................................... 125
First Attempt at Validation ............................................................................................ 125
More Validation Constraints ......................................................................................... 129
Custom Validation Messages ....................................................................................... 132
Other Approaches ......................................................................................................... 134
Conclusion .................................................................................................................... 135
■Chapter 9: Authors ............................................................................................ 137
The Authors Database Schema .................................................................................... 137
Fixing Broken Tests ...................................................................................................... 145
Conclusion .................................................................................................................... 163
■Chapter 10: The /authors API Resource ............................................................ 165
The GET /authors Endpoint ........................................................................................... 166
The AuthorsTransformer ..................................................................................................................... 166
The Author Controller .......................................................................................................................... 168

The GET /authors/{id} Endpoint .................................................................................... 170


A Basic Response ............................................................................................................................... 170
Including Other Models in the Response ............................................................................................ 171
The POST /authors Endpoint......................................................................................... 181
The PUT /authors/{id} Endpoint .................................................................................... 188

ix
■ CONTENTS

The DELETE /authors/{id} Endpoint .............................................................................. 197


Conclusion .................................................................................................................... 199
■Chapter 11: Book Bundles ................................................................................. 201
Defining the Relationship Between Books and Bundles .............................................. 201
The GET /bundles/{id} Endpoint .................................................................................... 206
Adding a Book to a Bundle ........................................................................................... 214
Remove a Book from a Bundle ..................................................................................... 215
Conclusion .................................................................................................................... 217
■Chapter 12: Ratings ........................................................................................... 219
Database Design .......................................................................................................... 219
Rating an Author........................................................................................................... 223
Adding an Author Rating ..................................................................................................................... 223
Deleting an Author Rating ................................................................................................................... 233

Ratings in the Author API .............................................................................................. 236


Eager Loading Ratings ................................................................................................. 240
Conclusion .................................................................................................................... 242
■Appendix: Where to Go From Here ..................................................................... 243
Laravel.......................................................................................................................... 243
Laracasts ...................................................................................................................... 243
Mockery ....................................................................................................................... 244
Guzzle ........................................................................................................................... 244

Index ..................................................................................................................... 245

x
About the Author

Paul Redmond has worked as a web developer, entrepreneur, and mentor


in software development for over a decade. He has built web applications
within startups, agencies, and enterprise customers with open-source
technologies. Paul is passionate about writing highly available applications
with PHP, JavaScript, and RESTful APIs.
Paul lives in Scottsdale, Arizona with his wife, Bernadette, three boys,
and one cat. He is usually wrangling code, kittens, and children, but finds
time to enjoy reading fantasy/fiction, writing, and watching sports.

xi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
About the Technical Reviewer

Jacob Jensen is a software engineer who loves testing, automating, and


clean code; he has a passion for teaching and learning, and has deep
experience in web development, design patterns, object-oriented design,
and a multitude of programming languages and platforms.

xiii
Acknowledgments

Writing a book is challenging. Editing a book more so.


Writing a book takes patience, persistence, time, and an abundance of help from others. When I first
envisioned this title, its humble beginnings were in the form of an eBook. I conceptualized, wrote, edited,
technically edited, designed, and marketed the concepts herein.
The Laravel (https://laravel.com/) framework and the Lumen micro framework have been inspiring
in my day-to-day work. They provide a pleasant and productive development experience that rekindled
my love for PHP and inspired me to share what I’ve learned with others. Additionally, the positive feedback
and word-of-mouth about this book within the PHP and Laravel communities—specifically Taylor Otwell
(https://twitter.com/taylorotwell), Michael Dyrynda (https://dyrynda.com.au/), and Amanda Folson
(http://amandafolson.net/)—was unexpected and huge motivation to keep pressing forward and making
the book better.
My early readers provided constructive feedback, small amounts of errata and grammar issues, and
insight into what they liked about the manuscript. Early reader feedback showed that people were actually
interested in my work, and found tips and tricks that helped them.
I would like to thank Steve Anglin and Mark Powers at Apress for guiding me through the writing
process. They have made a dream of mine come true: to author a technical book. I am thankful for their help,
and the help of everyone else at Apress who assisted me throughout the process.
Within my professional circle, the direct and indirect mentoring I’ve received from my colleague
Justin Rainbow has helped shape me as a developer and I am much, much better off for it. Thank you. My
colleague Jacob Jensen, the technical editor of this book, has been invaluable for motivating me, letting me
bounce ideas off of him, and providing great feedback on a technical and peer level.
Writing a book is a big commitment, involving many late nights, and I owe my wife, Bernadette, and
my children, Hayden, Masen, and Lincoln, the biggest thanks of all. Life is short. I am so fortunate to have a
wonderful family that supports me. I love you guys!

xv
Introduction

Lumen is a framework that is designed to write APIs. With the rising popularity of microservices
(http://microservices.io/patterns/microservices.html), existing patterns like service-oriented
architecture (https://en.wikipedia.org/wiki/Service-oriented_architecture), and increased
demand for public APIs, Lumen is a perfect fit for writing the service layer in the same language as the web
applications you write.
In my experience, it’s not uncommon for PHP shops to write web applications with PHP and API
services with something like Node.js (https://nodejs.org/en/). I am not suggesting that this is a bad idea,
but I see Lumen as a chance to improve development workflows for PHP developers and for companies to
standardize around a powerful set of complimentary frameworks: Laravel and Lumen.
You can write APIs quickly with Lumen using the built-in packages provided, but Lumen can also get out
of your way and be as minimalist as you want it to be. Set aside framework benchmarks and open your mind
to increased developer productivity. Lumen is fast, but more importantly, it helps me be more productive.

The Same Tools to Write APIs and Web Applications


Lumen is a minimal framework that uses a subset of the same components from Laravel (https://laravel.com/).
Together Laravel and Lumen give developers a powerful combination of tools: a lightweight framework for
writing APIs and a full-fledged web framework for web applications. Lumen also has a subset of console
tools available from Laravel. Other powerful features from Laravel are included like database migrations,
Eloquent Models (ORM Package), job queues, scheduled jobs, and a test suite focused on testing APIs.
The development experience between Lumen and Laravel is relatively the same, which means
developers will see a productivity boost by adopting both frameworks. Together they provide a consistent
workflow and can simplify the software stack for developers, release engineers, and operations teams.

Who This Book Is For


This book is for programmers that want to write APIs in PHP. Familiarity with the HTTP spec, Composer,
PHPUnit, and the command line will help, but this book walks you through each step of building an API.
You don’t need to be an expert on these subjects, and more experienced developers can skip things they
understand to focus on the specific code needed to write APIs in Lumen. This book does not cover every
detail of using Lumen, but focuses on the most important concepts needed to write testable APIs with Lumen.

Conventions Used in This Book


The book is a hands-on guide to building a working API, so you will see tons of code samples throughout the
book. I will point out a few conventions used so that you can understand the console commands and code.
The code is meant to provide a fully working API; you can follow along or copy and paste code samples.

xvii
■ INTRODUCTION

Code Examples
A typical PHP code snippet looks like this:

Example PHP Code Snippet


/**
* A Hello World Example
*/
$app->get('/', function () {
return 'Hello World';
});

To guide readers, approximate line numbers are used when you will be adding a block of code to an
existing class or test file:

Example PHP Code Snippet


10 /**
11 * A Foobar Example
12 */
13 $app->get('/foo', function () {
14 return 'bar';
15 });

Longer lines end in a backslash (\) and continue to the next line:

Example of Long Line in PHP


$thisIsALongLine = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qu\
os unde deserunt eos?'

When you need to run console commands to execute the test suite or create files, the snippet appears as
plain text without line numbers. Lines start with $, which represents the terminal prompt.

Example Console Command


$ touch the/file.php

Console commands that should be executed in the recommended Homestead1 environment will be
indicated like the following example. The book removes extra output from PHPUnit tests to make examples
less verbose.

Console Command in the Homestead Virtual Machine


# vagrant@homestead:~/Code/bookr$
$ phpunit

OK (1 test, 4 assertions)

1
https://laravel.com/docs/homestead

xviii
■ INTRODUCTION

Code Errata and Feedback


Submit errata to lumenapibook@gmail.com, or via the book’s apress.com product page, located at
www.apress.com/9781484221860. Feel free to send in typos, inaccurate descriptions, code issues, praise,
feedback, and code suggestions on better ways of doing something. Please don’t be shy; these things make
my book better!

Tips, Notes, and Warnings

YOUR ASIDE TITLE

This is an aside

Hey, Listen! Tips give you pointers related to concepts in the book.

Danger! Warnings point out potential issues and security concerns.

Need the Info This aside provides additional info related to code and concepts.

Git Commit: Amazing Refactor! rm3dwe2f

This is an example of a code commit if you are following along and using git to commit your work.

Discussions This tip includes deeper discussions around topics in the book. Advanced users can
generally skip these.

Tools You Will Need


All tools are recommended, but if you know what you’re doing, you can set up your own coding environment
and skip the recommended tools. You might even have these tools already; just make sure they are relatively
up-to-date. All tools listed are free unless otherwise noted.

VirtualBox
This book uses a virtual machine to run the API application. You will need to download VirtualBox if you
plan on using the recommended Homestead environment. VirtualBox works on Windows, Mac, and Linux
(www.virtualbox.org).

xix
■ INTRODUCTION

Vagrant
Homestead also requires Vagrant (www.vagrantup.com/) to manage and provision virtual machines. Vagrant
works on Windows, Mac, and Linux (Debian and CentOS).

Version Control
If you want to work along in the book and commit your code as you go (recommended), you need to install a
version control system. I recommend git, but anything you want will do.

Editor/IDE
Most readers will already have a go-to editor. I highly recommend PhpStorm (www.jetbrains.com/phpstorm/),
which is not free, but it pays for itself. Other common IDE options are Eclipse PDT and NetBeans.
If you don’t like IDEs, I recommend Sublime Text (www.sublimetext.com/) or Atom (https://atom.io/).
If you are on Mac, TextMate (https://macromates.com/) is another great choice. TextMate 2 is marked as
“beta” but is reliable.

xx
CHAPTER 1

Installing Lumen

Before you start diving into Lumen, you need to make sure PHP is installed. You’ll also need a few other tools
to develop a real application. You can get PHP a number of ways, but here is my recommendation for all
platforms: Laravel Homestead (laravel.com/docs/homestead). I also include a few different ways to install
PHP locally if you are interested, but the book examples will use Homestead. I highly encourage using
Homestead to work through this book.
To work through the applications in this book, you will need
• PHP >= 5.5.9, as well as a few PHP extensions
• Composer
• MySQL Database
Homestead comes with a modern version of PHP called Composer (https://getcomposer.org/), and
a few database options, so you don’t need to worry about the requirements if you are using Homestead; if
you are not using Homestead, you will need >= PHP 5.5.9 as outlined by the Lumen installation instructions
(https://lumen.laravel.com/docs/5.2/installation#installation).
The last thing on the list is a database. Lumen can be configured to use different databases including
MySQL, SQLite, PostgreSQL, or SQL Server. We will use MySQL (any MySQL variant will do) for this book.
MySQL is the default database connection in the Lumen Framework database configuration (https://github.
com/laravel/lumen-framework/blob/5.2/config/database.php) so we will stick with the convention.

Homestead
Laravel Homestead is the best development environment choice because it provides a complete
development environment for all your Laravel and Lumen projects. Homestead provides some solid benefits
for your development environment as well, including the following:
• Isolated environment on a virtual machine
• Works on Windows, Mac, and Linux
• Easily configure all your projects in one place
As mentioned in the introduction, Homestead requires Vagrant (www.vagrantup.com/) and VirtualBox
(www.virtualbox.org/) so you will need to install both. Follow the installation instructions
(https://lumen.laravel.com/docs/5.2/installation#installation) to finish setting up Homestead.

Electronic supplementary material The online version of this chapter (doi:10.1007/978-1-4842-2187-7_1)


contains supplementary material, which is available to authorized users.

© Paul Redmond 2016 1


P. Redmond, Lumen Programming Guide, DOI 10.1007/978-1-4842-2187-7_1
CHAPTER 1 ■ INSTALLING LUMEN

Once you complete the installation instructions you should be able to run the vagrant ssh command
within the Homestead project and successfully ssh into your Homestead virtual machine. You will revisit
Homestead to set up your sample application in Chapter 2, and then you will set up another application in
Chapter 3 that you will work on throughout the remainder of the book.
When the install instructions instruct you to clone the Homestead git repository, I encourage you
to clone it to ~/Code/Homestead to follow along with the book, or you can adapt the examples to match
whatever you pick (see Listing 1-1).

Listing 1-1. Cloning the Homestead Project to ~/Code/Homestead


$ mkdir -p ~/Code
$ git clone https://github.com/laravel/homestead.git Homestead

Once you finish the Homestead installation instructions you should be able to ssh into the virtual
machine (Listing 1-2).

Listing 1-2. SSH Into Homestead


$ cd ~/Code/Homestead
$ vagrant ssh
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)

* Documentation: https://help.ubuntu.com/
Last login: Tue Feb 2 04:48:52 2016 from 10.0.2.2
vagrant@homestead:~$

You can type “exit” or press Control+D to exit the virtual machine. The homestead repository will be
at ~/Code/Homestead and this is the path you will use in this book for your applications. I encourage you
to review the Homestead.yaml file at ~/.homestead/Homestead.yaml after you finish installing Homestead.
Once you get Homestead installed, you can skip ahead to Chapter 2. See you in the next section!

■ Optional Local Instructions The following sections offer information if you are interested in running PHP
locally, so feel free to skip them. I cannot guarantee these instructions, but for the most part they should work
for you.

Mac OSX
If you want to develop locally on OS X, I recommend using Homebrew (http://brew.sh/) to install PHP
and MySQL. The PHP installation that ships with OS X will probably suffice, but I will show you how to
install PHP with Homebrew instead of dealing with the different versions of PHP that ship with different
versions of OS X.
To install packages with Homebrew, you will need Xcode developer tools and the Xcode command line
tools. XCode is a rather large download—I’ll be waiting for you right here.
Once you have Xcode, follow the installation instructions (http://brew.sh/#install) on Homebrew’s
site. Next, you need to tell brew about “homebrew-php” so you can install PHP 5.6 (Listing 1-3).

2
CHAPTER 1 ■ INSTALLING LUMEN

Listing 1-3. Tap homebrew-php


$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php
$ brew install php56 php56-xdebug

Once the installation finishes, verify that you have the right version of PHP in your path (Listing 1-4).

Listing 1-4. Verifying PHP


$ php --version
PHP 5.6.16 (cli) (built: Dec 7 2015 10:06:24)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

Next, you need to install the MySQL database server with Homebrew (Listing 1-5).

Listing 1-5. Installing MySQL with Homebrew


$ brew install mysql

Once the MySQL installation is finished, make sure you can connect to the database server (Listing 1-6).

Listing 1-6. Connecting to MySQL


$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3795
Server version: 5.6.26 Homebrew
...
mysql>

I highly recommend updating the root password (http://dev.mysql.com/doc/refman/5.6/en/


resetting-permissions.html) and adding another user besides root, which you will use to connect to
MySQL. Although the database is local, securing MySQL is a good habit.
You can configure Apache or Nginx locally if you want to use a web server (Mac ships with Apache).
I’ll leave the rest up to you, but it should be pretty easy to get PHP and a web server going on a Mac by
searching Google.

Linux
Here are simple instructions to install PHP on Unix-like systems; this section includes the most popular
distributions like CentOS and Ubuntu. This is not an exhaustive set of setup instructions but it should be
enough to work with Lumen.

3
CHAPTER 1 ■ INSTALLING LUMEN

Red Hat/CentOS
To install a modern version of PHP on Red Hat and CentOS, I recommend using the Webtatic (https://
webtatic.com/) yum repository. First, add the repository with the Webtatic release RPM; you should use the
repository that matches your specific version (Listing 1-7).

Listing 1-7. Adding the Webtatic Repository


# CentOS/REHL 7
$ yum -y update
$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

# CentOS/REHL 6
$ yum -y update
$ rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Next, install the following PHP packages and verify that PHP was installed properly (Listing 1-8).

Listing 1-8. Installing PHP Packages from Webtatic


$ yum install \
php56w.x86_64 \
php56w-mysql.x86_64 \
php56w-mbstring.x86_64 \
php56w-xml.x86_64 \
php56w-pecl-xdebug.x86_64

# Verify
$ php --version
PHP 5.6.16 (cli) (built: Nov 27 2015 21:46:01)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

Next, install the MySQL client and server (Listing 1-9).

Listing 1-9. Installing MySQL on REHL


$ yum install mysql-server mysql

Once MySQL is installed, you should set a root password (Listing 1-10).

Listing 1-10. Securing the MySQL Installation


$ /usr/bin/mysql_secure_installation

Follow the prompts and you should be all set!

4
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
CHAPTER 1 ■ INSTALLING LUMEN

Debian/Ubuntu
On Debian systems I recommend using the php5-5.6 PPA (https://launchpad.net/~ondrej/+archive/
ubuntu/php5-5.6) from Ondrej Surý (https://launchpad.net/~ondrej) or the PHP 7 version of the same
PPA. Installation of the PPA varies slightly between different versions. Most of the steps will remain the same,
but the following are the steps for Ubuntu 14.04 and Ubuntu 12.04.
First, install a couple dependencies needed to add the PPA. If you are using Ubuntu 14.04, see Listing 1-11.

Listing 1-11. Installing Dependencies Needed and the PPA on Ubuntu 14.04
$ apt-get install -y language-pack-en-base
$ apt-get install -y software-properties-common --no-install-recommends
$ LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php5-5.6

If you are using Ubuntu 12.04, run the code in Listing 1-12 instead.

Listing 1-12. Installing Dependencies and the PPA on Ubuntu 12.04


$ apt-get install -y language-pack-en-base
$ apt-get install -y python-software-properties --no-install-recommends
$ LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php5-5.6

Note that non-UTF-8 locales will not work (https://github.com/oerdnj/deb.sury.org/issues/56)


at the time of writing. Next, update and install the required packages and verify; the commands are the same
for Ubuntu 14.04 and 12.04 (Listing 1-13).

Listing 1-13. Updating and Installing Packages


$ apt-get update
$ apt-get install -y \
php5 \
php5-mysql \
php5-xdebug

# Verify
$ php --version
PHP 5.6.16-2+deb.sury.org~precise+1 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

Next, install MySQL server and client packages, make the MySQL service start on boot, and start the
service manually (Listing 1-14).

Listing 1-14. Installing MySQL Packages on Ubuntu


$ apt-get install \
mysql-server \
mysql-client
$ sudo update-rc.d mysql defaults
$ sudo service mysql start

5
CHAPTER 1 ■ INSTALLING LUMEN

During the installation of the mysql-server package you should be prompted to update the root
password, which will look similar to Figure 1-1.

Figure 1-1. Configuring MySQL Root Password

Verify that you can connect to MySQL after you finish installing MySQL and setting a root password
(Listing 1-15).

Listing 1-15. Connecting to MySQL


$ mysql -u root -p
Enter password:

mysql>

At this point, you should have everything required to get through this book using the built-in PHP server
on a local Ubuntu machine.

Windows
I recommend using Homestead (http://laravel.com/docs/5.1/homestead#installation-and-setup) to
work through this book on Windows.

Conclusion
You should now have a working environment that you can use to write Lumen applications! Let’s summarize
what we did in this chapter:
• Installed Vagrant and VirtualBox
• Installed the Homestead virtual machine
• Covered alternative ways of installing PHP and MySQL
I want to emphasize how easy Homestead makes getting a solid, portable development environment
working with little effort. Now that you have PHP installed, it’s time to learn Lumen!

6
CHAPTER 2

Hello Lumen

Let’s dive right into Lumen. In this chapter, you’ll learn how to set up a new Lumen project and you’ll explore
some of Lumen’s basic features:
• Routing
• Middleware
• Requests
• Responses
To follow along, you should have the recommended Homestead environment from Chapter 1 installed.

Setting Up a New Project


Before you can get started, you need to create a new Lumen project in Homestead. To create a new project,
ssh into Homestead virtual machine and use Composer to create a new Lumen project (Listing 2-1).

Listing 2-1. Creating a New Lumen Application in Homestead


# On your local machine
$ cd ~/Code/Homestead
$ vagrant ssh

# In the virtual machine


vagrant@homestead:~$ cd ~/Code
vagrant@homestead:~/Code$ composer create-project \
laravel/lumen=~5.2.0 --prefer-dist hello-lumen
vagrant@homestead:~/Code$ cd hello-lumen

The book examples assume Homestead was cloned to the suggested path ~/Code/Homestead. Adjust the
commands if you cloned Homestead elsewhere.

In the Homestead virtual machine, you change the directory to ~/Code, where your application files will
live. Next, you use Composer’s create-project command to create a new Lumen project. The last argument
in the create-project command tells Composer to create the project in the path ~/Code/hello-lumen. Now
that you’ve created a new project on the virtual machine, you should also see a shared local path at ~/Code/
hello-lumen on your own machine.

© Paul Redmond 2016 7


P. Redmond, Lumen Programming Guide, DOI 10.1007/978-1-4842-2187-7_2
CHAPTER 2 ■ HELLO LUMEN

The next step is telling Homestead about the hello-lumen application. On your local machine, open
~/.homestead/Homestead.yaml and find the default project under the sites key (Listing 2-2).

Listing 2-2. Default Sites Configuration in Homestead.yaml


sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public

Replace it with the code in Listing 2-3 and save the file.

Listing 2-3. Default Sites Configuration in Homestead.yaml


sites:
- map: hello-lumen.app
to: /home/vagrant/Code/hello-lumen/public

Configure the project’s hostname and the path to the public folder on the virtual machine. Save the
file and run vagrant provision on your local machine to update Homestead with the new configuration
changes (Listing 2-4).

Listing 2-4. Provision Vagrant Locally


> cd ~/Code/Homestead
> vagrant provision

Every time you update Homestead.yaml you will need to run the vagrant provision command.

Once Vagrant is finished provisioning the machine, the last step is adding an entry to the hosts file on
your local machine. The hosts file will map the hostname hello-lumen.app to your virtual machine’s IP
address. You can find Homestead’s IP address by finding the ip key in the ~/.homestead/Homestead.yaml
file—you should see something like ip: "192.168.10.10".
Take note of the IP address so you can add it to the local hosts file. To update the hosts file on Mac or
Linux, the file path is /etc/hosts; if you are on Windows, the file path is C:\Windows\System32\drivers\
etc\hosts. Add the line from Listing 2-5 to your hosts file.

Listing 2-5. Adding Hostname to Hosts File


192.168.10.10 hello-lumen.app

Be sure to use the IP address found in your ~/.homestead/Homestead.yaml file, not the IP shown in this book.
It might be the same, but make sure.

After updating the hosts file, visit http://hello-lumen.app/ in your browser and you should see
something similar to Figure 2-1.

8
CHAPTER 2 ■ HELLO LUMEN

Figure 2-1. Lumen default route

You should now have a working hello-lumen project. Let’s get to work!

Routes
Routing (https://lumen.laravel.com/docs/5.2/routing) is the first feature we will cover. Application
routes in Lumen are defined in the app/Http/routes.php file. In the most basic form, routing configuration
includes an HTTP verb (GET, POST, etc.) which accepts a URI and a Closure. We will use the Closure style
routes in this chapter, but we will use controllers throughout the book.
The first routes will be two simple “Hello World” examples to introduce you to routing:
• /hello/world which responds with the text “Hello World”
• /hello/{name} which responds with a customized greeting
Before you define your own routes, if you open the file app/Http/routes.php, the default contents
looks like Listing 2-6.

Listing 2-6. The Default Lumen Route in app/Http/routes.php


<?php

$app->get('/', function () use ($app) {


return $app->version();
});

The $app variable in the routes file is an instance of \Laravel\Lumen\Application which is defined
in the bootstrap/app.php file. The application routes file is imported near the end of bootstrap/app.php
(Listing 2-7).

Listing 2-7. The Bootstrap File Importing Routes


$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
require __DIR__.'/../app/Http/routes.php';
});

9
Random documents with unrelated
content Scribd suggests to you:
“Yes, yes, I know; but—but——” She stared around her. “I—I—
where is the tent, and the horses?”
“You’ve had a nightmare, and it did us a heap o’ good,” broke in
Sam Barringford. “Your runnin’ around has scared off some redskins,
I reckon.”
By this time half a dozen were near. They gazed at the red warrior
whom Barringford had laid low.
“He is done for,” said Rodney. “He is too far gone even to question
him.” But even as the young soldier spoke the red man raised up
suddenly and flung his tomahawk squarely at Barringford. The fling
was a weak one and the weapon fell short of its mark. Then the
warrior sank back, gave a gasp, and was dead.
“Game to the last,” muttered Barringford. “Don’t know as I blame
him. Might be I’d do likewise, ef one o’ the varmin plugged me,” he
added philosophically.
It took several minutes for Mrs. Dobson to settle herself. Her
husband stated that she often arose in her sleep. She had been
terribly worked up over the red men ever since leaving Fort Pitt, and
this had gotten on her nerves.
The alarm kept the entire camp “on edge” until daybreak.
Barringford and two others made several tours in the immediate
vicinity, but could see or hear nothing more of the enemy.
“They have either cleared out entirely, or else they know how to
hide,” said the old frontiersman.
“Do you think it is the same party that Packerson met?”
questioned Rodney.
“Like as not, Rodney. We ain’t seen or heard o’ anybody else on
this trail.”
They went on as before, and the following forenoon made a
discovery that filled even the stoutest of them with horror. Coming to
a spot where the road led down to a ford over a good-sized brook
they beheld a man lying beside a rock, with one ear gone and part
of his scalp cut away. The man was shot through the body and was
all but dead.
“Who shot you?” asked one of the frontiersman, running up.
“Th—the Indians,” was the low and hoarse answer. “Water!”
Water was brought, but the man was almost too weak to drink.
One of the party recognized him as Stephen Banoggin, a trader well
known in those days around Carlisle and Bedford. Banoggin had left
Bedford ten days before, with a view of establishing a new trading
post in the vicinity of Venango as soon as it seemed safe to do so.
“All dead—all killed by the Indians!” was about all he could say.
“Fool, fool that I was to attempt it! All dead!” And that night he
expired.
His tale was almost true, although not quite so. His pack-train had
consisted of ten horses and nine men, including three negroes who
were his slaves. The Indians—a mixed band under a chief called
Crow Feather—had ambushed the train at the ford and slained or
mortally wounded all but one negro and a white hunter named
Sturm, a German from upper Pennsylvania. Sturm and the negro got
away together, each however wounded. They traveled for four
weeks in the forest, when Sturm went crazy. At last they reached a
settlement, where the negro told his story. Sturm was placed under
medical care and regained his reason some time later.
The sights presented to Rodney and the others at the ford were so
revolting that Mrs. Dobson, Nell, and the twins were held back, that
they might not see what had occurred. The slain were all scalped
and an effort had been made to burn one at the stake. The bodies of
the men and the dead horses lay together. Four horses were
missing, and on these the Indians had packed such stores as they
wanted, scattering the other goods or burning them.
“This is enough to make one sick!” said Rodney, as he turned
away with a shudder. “These redskins must have been fiends!”
“They were certainly cold-blooded,” answered Barringford. “Poor
Banoggin! He had better have stayed in the east.”
“Sam, this doesn’t look as if it would be safe for us to go any
further.”
“Easily said, lad; but what are ye goin’ to do?”
“You mean it is as safe to go forward as to turn back?”
“Don’t it look thet way?”
“Maybe. But we are a little closer to Fort Pitt than we are to Fort
Cumberland.”
“Thet’s true too. But I don’t reckon the Injuns will dare to go as
far east as Cumberland—not after the lickin’ they got at Bushy Run.”
“The band that did this can’t be the band that tried to surround
us.”
“No, they are another tribe, I think.”
“Then the forest must still be full of wandering bands, and we are
not near as safe as we thought we were.”
“We’ve got to make the best on’t, Rodney. We must travel as fast
as we can and keep our eyes peeled more’n ever before. It’s the
only way out, so far as I kin see.”
The bodies of the slain were placed in a hollow, with some flat
stones on top, to keep off the wolves and other wild beasts. The
place was marked on the trees. A few of Banoggin’s possessions
were taken along and the others left where they had fallen.
“Poor fellow, he will never want anything in this life again,”
murmured Rodney, brokenly. And when the trader died they placed
his body away with those of his followers. Fortunately he had been a
bachelor, so there would be no widow or child to mourn his loss.
Early in the morning Rodney and those with him moved on again.
Everybody in the party was exceedingly sober. All realized their great
danger. The fate of Stephen Banoggin and his party was ever before
their eyes and in their thoughts.
CHAPTER IX
UNDER THE CLIFF

“Thank fortune we have come so far without injury!”


It was Rodney who uttered the words. He and Sam Barringford
were standing on a little rise of ground, the trail in front and behind
them. The warm noonday sun shone down upon them, and all was
calm and peaceful with not an enemy of any kind in sight. Close at
hand Dobson and his wife were preparing a meal for all hands and
little Nell was playing with the twins.
Two days had passed since they had left the fateful ford, and they
had covered thirty-two miles, over a trail which the past rains had
left in anything but a good condition. They had been on guard every
minute, day and night, their nerves strung to top tension. The early
morning had taken them through a spot lined upon either side with
tall rocks, and they had expected a shot at almost every turn—but
nothing had come to disturb them.
Considering the condition of the road, the horses had done well.
Only one was injured,—from slipping over some rocks,—but he could
still carry his load. Nobody was sick, although the constant worry
had given Mrs. Dobson a headache.
“While we are waiting for dinner, let us go ahead and look at the
trail,” suggested Rodney; and Barringford agreed. Not far off was
another hollow, backed by a cliff of rocks, overgrown with heavy
vines, and they were both anxious to know what was beyond.
They gained the region of the cliff without difficulty. To save
himself the trouble of climbing the rough rocks, Rodney tested the
vines and then commenced to pull himself up, hand over hand.
“Be careful that you don’t fall!” cried the old frontiersman. “These
rocks at the bottom ain’t no easy bed to drop on, I kin tell ye thet!”
“The vines are strong enough to hold a horse,” answered the
young soldier.
He continued to go up, until he was a good fifteen feet over
Barringford’s head. He had still six feet to go, when he heard a slight
sound from above.
“Must be the vines tearing away,” he told himself, after a pause.
“Maybe they are not as strong as I thought they were.”

He glanced up, saw his


dire peril, and let himself
drop.—Page 77.

He waited and then went up an additional foot or two. The vines


held, and he took another grip of them a little higher up. His head
was now within a yard of the top of the cliff, which was covered with
the vines and a stunted growth of bushes.
Suddenly, from out of the bushes, there appeared the head of an
Indian, bedecked in war-paint and feathers. Then a long, bronzed
arm stole forward, holding a tomahawk. The tomahawk was raised
and a blow was aimed at Rodney’s head.
Had the blow fallen as intended, the young soldier’s skull must
have been cleft in twain. He glanced up, saw his dire peril, and let
himself drop. An instant later a shot rang out from below, and the
Indian’s hand quivered and the hatchet slipped down among the
vines and out of sight.
Rodney struck the rocks below heavily and rolled over. When he
sat up he found Sam Barringford beside him, the smoke still rolling
out of the frontiersman’s gun.
“Oh, Sam——” he began, and knew not what further to say.
“Press in clost to the wall,” answered the frontiersman, hastily, and
began to reload his rifle with all speed. Rodney’s gun stood against
the rocks, where he had left it on starting to mount the cliff.
“Did you hit him, Sam?”
“Yes, an’ I reckon I broke his wrist—leas’wise, he drapped the
tomahawk. It was a narrer shave fer you, lad.”
“Indeed it was.” Rodney tried to catch his breath, which the
sudden drop had knocked out of him. “Do you suppose he is alone?”
“Ain’t supposin’ nuthin jest yit. Are you all right?”
“I—think so.”
Both pressed in close to the rocky wall, so that no one standing
above could see them. They listened, but no sound from above
reached them.
“Perhaps the Indian ran away,” said Rodney, wiping the blood from
where his left hand had been scratched.
“Don’t be too sure, Rodney.”
“If the enemy are so close we ought to warn the others.”
“The rifle shot will do that. Maybe somebuddy will be comin’ this
way soon.”
They waited another five minutes, even the old frontiersman not
knowing exactly what to do. Then they saw a frontiersman named
Casbury coming forward, slowly and cautiously.
“Look out!” shouted Barringford. “Injun on the rocks!” And he
pointed upward.
Casbury understood, and promptly dove out of sight behind some
bushes. As he did this there was a crashing through the vines, and a
mass of rocks and dirt came down directly in front of where Rodney
and Barringford were standing.
“Goin’ to bombard us with rocks, hey?” snorted the old
frontiersman. “Maybe I kin play ye a trick fer that. Groan, Rodney,
groan,” and he began to groan and moan, as if in the greatest of
pain. Rodney did the same, keeping it up several minutes. Then both
began to breathe heavily, as though totally exhausted.
Several minutes more passed and Rodney and Barringford
breathed softer and softer. Thrown off their guard, and thinking the
whites dead or mortally hurt, three Indians leaned over the edge of
the cliff to get a view of the situation.
The young soldier and the old frontiersman were on the alert, and
as soon as the warriors appeared they blazed away. Two drew back,
one with a shot through the side of the neck. The third pitched
forward with a yell, struck the rocks head first, and lay dead where
he had landed.
“There, I reckon thet will teach ’em a lesson,” cried Sam
Barringford, as he and Rodney again loaded up.
A shot was now fired by Casbury, and another Indian was hit in
the shoulder. Then Casbury saw four Indians run from the front of
the cliff and disappear in the bushes far back.
“Come on, if you want to!” cried Casbury, and leaving the shelter
of the cliff Rodney and Barringford made for the camp with all haste.
Here they found all the others on guard. The midday meal was
forgotten, and the men stood ready to shoot the moment a red
warrior showed himself.
“This is the worst possible place to be caught in,” said Rodney.
“The Indians can get behind yonder trees and pick us off at will—if
they have any firearms.”
“I saw nothing but bows and arrows,” said Casbury. “Still, they
may have guns.”
The situation was talked over while they waited for the Indians to
reappear. Some brushwood had been gathered for the fire, and Mrs.
Dobson and the children were placed behind this and behind some
of the horses.
“I’m going over into the woods,” said Barringford, to the others.
“If I see anything wrong, I’ll screech like an owl.”
“Do you want me to go along?” asked Rodney.
“No, lad, I want you to stay here, by Nell an’ the twins.”
Barringford slipped to the rear, crawled through the grass, and
thus reached a few low bushes, from which he made his way into
the forest.
Two hours went by slowly. Not an Indian showed himself, nor did
any signal come from Barringford. The men remained on the alert,
and when a rabbit crossed the trail two drew a bead on the animal
like a flash.
“I trust Sam hasn’t gotten into trouble,” said Rodney, at last.
“If he has, he’ll have to git out o’ it,” answered one of the others,
with a shrug of his shoulders.
Presently one of the regulars saw a form wriggling through the
grass. He was on the point of firing when he recognized the old
frontiersman. Barringford came in a good deal out of breath.
“We’ve got to move, an’ move quick, too!” he announced. “There’s
a crowd o’ thirty Injuns over thar,”—he pointed with his hand. “They
are goin’ to attack us as soon as the sun goes down.”
“But where shall we move to?” questioned Rodney.
“I war thinkin’ o’ thet cave ye spoke about, Hempser,” went on
Barringford, turning to one of the other old hunters. “You said it war
nigh here.”
“It’s half a mile beyond the cliff,” was Hempser’s answer. “I don’t
know the way very good, but I think I can find it.”
“Then thet is where we’ll go, an’ to onct,” decided Sam
Barringford.
Not a minute was lost in breaking camp, and in a close body the
pack-train set out, past the cliff and then through a valley of heavy
grass and bushes. The men carried their guns ready for use, and
screened Mrs. Dobson and the children as much as possible.
“Oh dear! I’d rather be dead than be so worried,” sighed the
woman. “I am that nervous I am ready to drop!”
At the end of the short valley was another rise of rocks, among
which was located the cave. They had just gained the first of the
rocks when a hideous war-whoop sounded out on the afternoon air.
“They have discovered us!” cried Rodney, and he was right. At the
far end of the valley appeared fully a score of Indians, a few on
horseback and the others on foot.
The Indians had been surprised, thinking the whites were still on
the trail. But they soon recovered, and came riding and running
towards our friends, yelling at the top of their lungs and flourishing
their tomahawks. A moment later they sent a volley of arrows and
several rifle shots, for some carried one kind of weapon and some
the other.
“Are you hurt?” asked Barringford of Rodney, as he saw the young
soldier stagger.
“No, an arrow hit me in the coat-sleeve, that’s all—it didn’t get
through my shirt though.”
One of the regulars had been struck by a bullet in the shoulder,
and his friends had to help him along. Then the Indians sent forth
more arrows, one of which tore through little Nell’s dress.
“Oh!” cried the little miss, in great terror.
“Give ’em a dose o’ their own medicine!” ordered Barringford.
“Make the shots tell!” And then everybody fired at the advancing foe,
and three of the red warriors pitched into the grass, while two
others stopped running and then limped to the rear, badly wounded.
Hempser was looking around anxiously for the cave. At first he
could not locate it, but, just as the Indians advanced again, he
discovered a hole and rushed towards it.
“Here you are!” he shouted. “This way! Once in the cave, I think
we can hold ’em at bay!”
“Into the cave!” cried Barringford. “Mrs. Dobson and the children
first. Hempser, is there a back opening?”
“Yes, but not a very big one. We can close it up with loose rocks.”
“Then you run back and pile up the rocks. The others remain at
this opening, to keep the Indians at a distance.”
CHAPTER X
BARRINGFORD AS A SCOUT

The volley poured into the Indians by the whites made the red
warriors pause for the time being. They were close to a clump of
bushes and trees growing near the center of the glade, and they got
behind this shelter with alacrity.
In the cave all was confusion. It was an opening ten to fifteen feet
in height and equally broad at the mouth. It ran back a distance of
over two hundred feet, where it ended in a split among the rocks,
coming out at a point where there was a thick patch of nettle
bushes.
The horses had been brought into the cave and were led to the
rear. Here Hempser worked like a Trojan, with one of the regulars
helping him. Loose stones were to be had in plenty, and they
blocked up the rear opening completely.
“They’ll have their hands full, getting in this way,” said the regular.
“The nettles will keep them back if nothing else will.”
“Right you are,” answered Hempser. “Injuns don’t like to git
scratched any more than anybody else.”
At the front of the cavern Sam Barringford took command. A
glance showed him how the land lay, and he at once ordered some
of the men to pile up the loose stones to a height of several feet.
This formed a barricade, behind which the frontiersmen and regulars
could lie with but little danger of the enemy picking them off.
“This is a situation we didn’t bargain for,” said Rodney, after the
construction of the barricade had come to an end. “I must say I
don’t like it.”
“Well, lad, it’s better than being surrounded in the open,”
answered Barringford, with an effort to look on the bright side of the
affair.
“I don’t think they’ll attack us now,” went on the young soldier.
“But they may do it to-night.”
“We’ll have to keep on guard, and shoot the first man who shows
himself,” put in Casbury.
“Maybe they’ll try to starve us out,” came from another of the
frontiersman.
“We’ve got rations enough for a week or more, on a pinch,” said
Rodney. “We’ve got our regular things and also that deer Barton shot
early this morning, and some rabbits.”
“How about water?” asked another.
“We’ll have to see about that,” said Sam Barringford.
Satisfied that the Indians did not contemplate an immediate
attack, the old frontiersman, accompanied by Rodney, made a tour
of the cave, lighting a torch for that purpose. In one corner the
rocks were found to be very damp, and when some were pulled up a
little water trickled forth.
“Thar’s a spring thar,” said Barringford, with satisfaction. “We kin
do a bit o’ diggin’ an’ then have all the water we wish.” A little later
two of the regulars set to work, with pike-poles and shovels, and
soon had a hollow made into which the water flowed to a depth of
several inches. The water was brought up in a dipper, and proved to
be both clear and wholesome.
As the time slipped by the whole party became more composed,
and Nell and the twins clamored for their delayed dinner. A meal was
prepared in the cave, which the men ate while on the watch.
“Oh, Rodney, will the bad Indians catch us in here?” asked Nell, as
she came up to her elder brother.
“I think not, Nell,” he answered, hopefully.
“I wish I was home.”
“So do I, Nell—wish it more for your sake than for my own.”
“Tom wants to go out and fight the bad Indians,” said one of the
twins. He had picked up a rifle resting against the wall and was
trying to shoulder the long weapon.
“Here, you give me that gun!” cried Rodney, reaching for it. “Tom,
you mustn’t play with the guns. One of ’em might go off and hurt
you.”
“Tom ain’t ’fraid of no gun,” said the little boy. “Want to shoot the
Indians.”
“You keep quiet and stay with Mrs. Dobson or Nell.”
“How long will we have to stay here, Rodney?” asked his little
sister.
“I can’t answer that question, Nell. It depends on the Indians.
Perhaps they’ll get tired of watching us and go away.”
It was a hard matter to keep the twins quiet, but presently both
grew tired of wandering around the cave, and went to sleep on a
pair of blankets spread out for them. Mrs. Dobson sat on one of the
packs with Nell beside her and her husband not far off.
“Oh, Asa, how foolish we were to come out to this western
country!” sighed the woman, for at least the fiftieth time. “We
should have stayed at home and been content with what we had!”
“Ain’t no uset to cry over spilt milk,” grumbled her husband.
“I think the Indians will come to-night and scalp all of us!”
“Oh, Mrs. Dobson, you don’t mean that!” gasped little Nell.
“Don’t scare the little girl, Mrs. Dobson,” put in Casbury, who
chanced to be near. “It won’t help matters to git anybuddy worked
up.”
At last the sun sank in the west and it began to grow dark at the
mouth of the cave. Two men were stationed at the spot where the
rear opening had been, and all the others gathered at the front.
Then Sam Barringford called Rodney to him.
“I’m a-goin’ out on a scoutin’ tour,” said the old frontiersman. “I’m
a-goin’ to leave you an’ Casbury in charge until I git back. Don’t
shoot me, but don’t let none o’ them Injuns git near, nuther.”
“Don’t you want me to go with you, Sam?”
“No, it will be hard enough fer one to git around, let alone two. Ef
ye ain’t sure it’s me comin’ back, hoot like an owl an’ I’ll answer like
a catbird, understand?”
“Yes.”
Barringford gave the others a few directions and then, stepping
quickly over the rocks, snaked his way along through the grass to a
fringe of low bushes. From the bushes he made for the rough rocks,
where he paused, to consider the situation in all of its details.
The old frontiersman felt that he was surrounded by enemies fully
as alert as himself and ready to shoot him down on sight.
“An’ they won’t ax me if I’ll like it nuther,” he murmured to himself.
“They be jest a-hankerin’ arter my sculp like all possessed.”
Peering cautiously around, he saw nobody, and after a short wait
took his way between the rocks towards the spot where the rear of
the cave was located. Here he listened again, and this time heard
the low murmur of two voices. But they were those of Dobson, the
settler, and a regular, talking from inside.
“They ought to know enough to keep quiet,” mused the old
frontiersman, in disgust. “How can they spot the enemy if they gab
like thet?”
In a few minutes the voices ceased, and thinking the coast clear
the old frontiersman worked his way among the rocks and through
the bushes toward a point he imagined the Indians might be
holding. The darkness of night had now fallen completely over the
forest and scarcely a sound broke the stillness.
Barringford was about to cross to another patch of brushwood
when the distant call of a night bird arrested his attention. He was
well versed in the calls of all birds and that which he heard did not
sound exactly true to his ear. He smiled grimly to himself and
waited.
As he had surmised, an answering call soon followed. It came
from the very brushwood he had been on the point of entering, and
a tall Indian stepped forth, as if to advance. Before Barringford could
retreat or draw to one side the pair were face to face.
Not a word was uttered—indeed, there was no time for speech.
The Indian had his tomahawk in his hand, and this he raised, aiming
a blow at the old frontiersman’s skull. As old as he was getting,
Barringford was still nimble on his feet and dexterously dodged to
one side. As the arm of the red warrior came down, he caught the
red man by the shoulder, and over went the pair on the soil. Then
the Indian tried to cry out, but Barringford’s hand was clapped on his
mouth.
It now became a desperate but silent struggle for life. From the
red man’s mouth, the old frontiersman’s hand was shifted to his
throat, which was caught with a grip of steel. The Indian struggled
desperately, first kicking heavily and then drawing up a knee against
Barringford’s breast. Then he tried to use his tomahawk again, and
hit the frontiersman a glancing blow on the shoulder. The hatchet
fell, and in a twinkling the Indian had Barringford by the throat, in a
clutch equally firm and relentless.
Like two bulldogs that have a death-grip and will not let go, white
man and Indian rolled over and over, on the rocks and in the bushes,
each doing all in his power to get the better of the other. The Indian
was muscular, and his strength was equal if not superior to that of
his white adversary. But Barringford had secured the first grip, and
the red man’s breath was fast leaving him. His tongue stuck out, his
eyes bulged from their sockets, and he could not utter even so much
as a faint gurgle.
It was at this moment that an interruption came. Another form
glided into the midst of the bushes. It was a second Indian, and a
glance showed him the condition of affairs. Without stopping to use
his tomahawk or his knife he kicked Barringford heavily in the left
ear. Then followed other blows, and with a groan the old
frontiersman stretched out on the rocks unconscious.
As the hold on his throat relaxed the Indian who had been in the
death struggle gave a gasp and stared about him. The coming of his
fellow warrior had undoubtedly saved his life.
“Where did that white man come from?” asked the second Indian,
as he gave Barringford a close look.
“Cushina knows not,” was the faint reply. It was some time before
the other could get back his breath.
“Are there others about?”
At this question Cushina shrugged his shoulders.
“Did he come from the cave, think you?”
“Perhaps—all of the whites were driven to that shelter, like so
many dogs of the prairie.”
“It may not be so. Others may be at hand. We must be careful.
Moon Eye has news of some soldiers. They may be marching in this
direction.”
“Then Moon Eye himself is here?”
“Yes.”
The first warrior drew a long breath and then brought from his
girdle a keen hunting knife. He felt of its edge with satisfaction.
“Mist of the Lake has come to the aid of Cushina and has brought
the white man to grief,” said he, looking at the other closely. “Does
Mist of the Lake claim the scalp?”
At this query the second Indian shrugged his shoulders.
“Does Cushina still wish to linger in the footsteps of Laughing Eyes
and make her his bride?” he asked, after another pause.
Cushina winced at this question. Both he and Mist of the Lake
were in love with the same Indian maiden. As Mist of the Lake had
saved his life he was bound, according to the laws of his tribe, to
give his rival a clear field in his wooing.
“Laughing Eyes is Mist of the Lake’s—if she will have him,” he said,
in a low voice.
“And the scalp of the white man belongs to Cushina,” was the
prompt reply of the other warrior. “He can take it at his pleasure.”
CHAPTER XI
IN WHICH WHITE BUFFALO APPEARS

“Something must surely have happened to Sam, or he wouldn’t


stay away as long as this,” said Rodney to Casbury, after half the
night had passed without the old frontiersman reappearing.
“I am afraid you are right, Rodney. Maybe the Injuns caught an’
killed him.”
“Don’t you think somebody ought to go out and try to hunt him
up?”
“It won’t be any safer for us than it was for him,” answered the
borderman, with a grave shake of his head.
Had it not been for Nell and the twins Rodney might have gone on
a hunt for his old friend. But he felt his responsibility, and so
remained in the cavern. He felt that if an attack came his place was
beside his sister and the twins. Barringford thought as much of the
twins as if they were his own flesh and blood, and would not forgive
him did he not do all he could to shield the youngsters from harm.
Slowly the time wore away. Nell, the twins, and Mrs. Dobson had
gone to sleep, and also several of the frontiersmen and regulars,
who were off duty for the time being. The cave was kept in total
darkness, so that those inside could see better what was happening
without.
Rodney had listened for the cry of a catbird in vain, and stood
leaning against a rock, peering forth into the semi-darkness. He was
tremendously sleepy, having gotten only a short nap the night
before.
Presently he straightened up and listened. Was he mistaken, or
had he heard the croaking of a frog? He had not noticed this earlier
in the night.
He was not mistaken; the croaking was repeated, at regular
intervals. He could not resist the temptation to croak also, mimicking
the sound as best he could. At once the answer came back, and the
heart of the young soldier gave a bound of astonishment and
gratification.
The call was one often used by White Buffalo, the old chief of the
Delawares who had proved such a friend to the different members of
the Morris family. What he could be doing in this vicinity was a
mystery, since it was supposed that he was either at the regular
village of his tribe or at the conference being held by Sir William
Johnson and the red men at Johnson Hall.
“Perhaps it’s a ruse,” thought Rodney. “I must be on my guard—it
won’t do to be caught in a trap.”
The croaking of the frog continued, moving gradually closer to the
mouth of the cave. Then Rodney saw something wave in the air,
between two bushes. The object went up and down twice, then
crosswise three times and then around in a circle.
“White Buffalo true enough!” murmured the young soldier. He
called some of the others to his side. “White Buffalo, a friendly
Indian, is out there. He wants to talk to us.”
“I’ll trust none of them,” said one of the regulars promptly. “They
are all cutthroats!”
“White Buffalo has been a friend to our family for years,” went on
the young soldier. “I can vouch for him in every respect. You know
him, Casbury, and so do you, Malloy.”
“Yes, he is square, so far as I know,” answered Casbury.
“He’s a putty good Indian, so he is,” said the Irish borderman
mentioned. “But not wan av thim can be thrusted whin the war’s
goin’ ag’in ’im. Betther be afther bein’ careful, Rodney.”
“He wants to talk to us—he has something important to say,”
persisted Rodney.
“How do yez know that?”
“He just signaled to me. He and my brother Henry and cousin
Dave are great friends, and White Buffalo taught us some of his
signals. We had better let him come in and talk to us.”
Those in the cave discussed the matter and at last agreed to
follow Rodney’s advice. But they remained on guard, to shoot White
Buffalo or any other Indian down, at the first sign of treachery.
The matter settled, Rodney signaled White Buffalo to approach.
He started to go forth, to meet the friendly red man, but White
Buffalo quickly warned him back. In a minute the old Delaware chief
was in the cavern.
“White Buffalo, I am glad to see you,” cried Rodney, shaking
hands.
“How! how!” returned the aged Indian. He peered closely at
Rodney in the darkness. “My friend Rodney is better? He can walk
well?”
“Yes, I am much better. And how are you? Hello, there is blood on
your face!”
“White Buffalo had a fight—down by the river—with some other
Indians. They had almost killed his old friend Barringford.”
“Sam! Is he alive?”
“Yes—White Buffalo knocked an Indian over. Then he took Sam
and ran through the forest. They were about to torture Sam—to
make him speak of this place and who was here. First one Indian
wanted his scalp, but Moon Eye came up and stopped the bloody
work.”
“And you fought the Indians alone?”
“No, White Buffalo has six warriors with him—they are watching
down at the river. Sam could not come—he is too sorely wounded.
He sent White Buffalo. He told White Buffalo to cry as a catbird, but
that is a bad signal—it would bring Moon Eye and his warriors to the
spot. So White Buffalo used the old signal—the one he taught to
Dave and Henry. He thought his friend Rodney would remember.”
“And I did remember. But you are hurt. Let me bind up the
wound.”
“’Tis but a scratch,” answered the aged Indian. The cut smarted
greatly, but he would not show his pain.
“See here, what do you know about the other Indians around
here?” asked Casbury.
“They number thirty,” said White Buffalo, who had learned how to
count in English style. “All strong, crafty, and full of the war spirit.
White Buffalo’s small band can do but little against them.”
In his own fashion the Indian then told his story in detail, how he
and his followers were journeying to a distant village, to try to bring
their entire tribe in harmony with each other. They had seen the
actions of Moon Eye and his followers while at a distance and come
to the conclusion that something unusual was going on. They had
come closer and heard the other Indians discuss the subject of an
attack on the cave. The followers of Moon Eye intended to wait until
daybreak and then try to smoke out those in the place. All the men
were to be shot down and scalped, and the woman and the children
were to be made captives. This much White Buffalo had learned
before going to the rescue of Sam Barringford. What Moon Eye and
his men were going to do now, the old chief could not tell.
“What do you think we had best do?” asked Rodney, after the
recital had come to an end.
“Escape from the cavern without delay,” answered the aged
Indian. “’Tis the only hope. Unless that is accomplished you will
surely be shot down like bears coming from a smoke-out.”
“How shall we go?”
“If you will trust yourselves to White Buffalo he will do what he
can,” answered the old chief, simply.
Rodney was willing, and some of the others said they would follow
the chief, but several of the regulars demurred and so did Malloy the
frontiersman.
“I’ll thrust meself to no redskin,” said the Irishman, with a
vigorous shake of his head. “I have no desire to wake up in the
marnin’ wid me throat cut!”
“I shall follow White Buffalo,” said Rodney, decidedly. “And I shall
take Nell and Tom and Artie with me.”
“White Buffalo is a good Indian!” cried Nell, who had awakened
and run forward to greet the old chief, whom she knew by the voice.
“I know he will save me,” and she took his hand confidently.
At last Malloy and the regulars gave in and all looked to see what
White Buffalo’s first move would be. His plan to rescue them was as
old as it was simple.
“White Buffalo will go back to his braves,” said the aged chief.
“They will make a great noise to the northward, fire shots and yell.
They will attack one or two of Moon Eye’s men. That will cause
Moon Eye to rush with more warriors to that point. Then my friends
must slip away in the darkness and go down to the river—to the
spot where Sam has been left. I will tell how the spot can be found.”
And he did so.
This matter arranged, White Buffalo added that he and his braves
would join the whites in the morning—the signal to be the croaking
of frogs. Then, after a few additional words to Rodney, he bowed to
those around him, leaped over the barricade of stones, and vanished
into the night.
No time was lost, after the departure of the aged Indian chief, in
getting ready to leave the cave. Such things as could be dispensed
with were left behind. Two horses were brought to the front, and
Nell and Tom were placed on one and Mrs. Dobson and Artie on
another. All the men looked to their firearms and their hunting
knives.
“This may be our last night on earth,” said one regular. “At the
best, we have only a fighting chance.”
Casbury had followed White Buffalo and was outside, on the
watch. He fancied that he saw an Indian at a distance, but was not
sure and did not fire.
A half-hour went by—an unusually long time to those in the
cavern, whose nerves were strung to the topmost pitch. All was now
in readiness for the flight, but so far not a sound had broken the
stillness.
“Mebbe something has miscarried,” observed one regular.
“White Buffalo may be dead,” said another. “One of the Moon Eye
crowd may have been lying in wait for him.”
A few minutes more passed, and even Rodney was beginning to
worry, when from a distance came a rifle shot. Then arose a mad
yelling, and more shots were fired. The din increased, until the alarm
appeared to spread through the whole of the forest to the north of
the cave. White Buffalo and his six trusty followers were making
noise enough for a band of fifty, and it must be confessed that Moon
Eye and his warriors were taken completely by surprise.
“’Tis the Delawares!” was the cry. “They have come to do us
battle!”
“Mist of the Lake has been killed!” called out another. “And Squat
Foot is wounded!”
The din kept on, and for the time being the attention of all the
Indians was taken from the cavern. This was what Rodney had
hoped for, and as soon as he thought it safe, he ordered an
advance. The men rushed out of the cave and, finding the coast
clear, urged forward the horses, and away went the whole
expedition into the woods to the south of the cavern.
“There is one Injun!” cried an old frontiersman.
“Don’t shoot—unless it becomes necessary!” said Rodney, hastily,
as the man raised his rifle. “If we can get away silently, so much the
better.”
The Indian had only his bow and arrows with him. He did not stop
to attack the whites, but ran into the forest,—to join those moving to
the north. He, like the others, imagined that a large band of their
hated rivals, the Delawares, had appeared.
Rodney kept as close as possible to the horses on which rode Mrs.
Dobson and the children. On the other side was Asa Dobson, in such
a tremble that he could scarcely walk. The settler imagined that
every minute might be his last.
“I’d give all my money to be back home again!” he groaned.
“Money doesn’t count here,” said Rodney, briefly. “We must use
our wits, and if the worst comes to the worst, fight to the last,—for
the sake of your wife and the children!”
CHAPTER XII
HOME ONCE MORE

The route to the river was a rough one, over jagged rocks and
around stunted growths of evergreens and elderberry bushes, with
here and there a bramble bush or a tangle of wild grapes. Often the
men stumbled, and it was with difficulty that the horses got through
without throwing their loads.
Not a word was spoken, Rodney cautioning all to silence. Every
eye and ear was on the alert. Who knew but what they might be
running into an ambush of the worst kind?
When the watercourse was gained,—a small stream flowing to the
southeastward,—they came to a halt in a small grove of hemlocks
and walnuts. Not another Indian had appeared, for which all were
thankful.
The din to the northward was now growing less, and Rodney was
certain that White Buffalo and his handfuls of braves were in retreat,
not daring to meet the superior force under Moon Eye.
On gaining the vicinity his Indian friend had mentioned to him,
Rodney lost no time in looking around for Sam Barringford.
“Sam!” he called, softly. “Sam, are you here?”
“Rodney!” came in a weak voice. “Here I be—an’ glad ye have
come!”
The old frontiersman was up in a short, wide-spreading tree,
where White Buffalo and another friendly red man had placed him.
He was weak from his encounter with the enemy and glad to have
the young soldier and the others come to his aid.
“I had what ye might call a putty clost shave,” said Barringford.
“They got me down an’ one o’ the rascals war a-goin’ to sculp me
when Moon Eye cuts in an’ says to let me alone—he would torture
me into tellin’ em’ some o’ the white folks’ secrets—about the fort
an’ the soldiers on the march, an’ sech. They war a-goin’ to burn me
at a stake—jest as them Injuns war goin’ to burn me when I war on
my way to Detroit with Dave,—when White Buffalo plays a trick on
’em.”
“What did he do, Sam?”
“Got one o’ his followers to wave a torch from some rocks. The
feller war kivered with a white blanket an’ I reckon they took him fer
a ghost. When Moon Eye’s crowd war lookin’ at the figger in white,
White Buffalo come up to me, fixed up as one o’ the enemy, an’ cuts
me loose. I didn’t know him myself till he spoke. The disguise did
the trick, and we got away into the forest. Then I dropped, I war
thet weak, and they brung me here. Then he said he would do what
he could fer ye—an’ he must have kept his word, or ye wouldn’t be
here,” concluded the old frontiersman.
White Buffalo had mentioned another spot—down the river—
where the party of whites might wait until morning for the
Delawares to join them. Helping Sam Barringford upon one of the
horses that had been carrying supplies, they set off for the place
mentioned, reaching it without mishap just as day was breaking.
By this time the entire party was so worn out that half the number
were glad to throw themselves down to rest, leaving the others on
guard for two hours, when they were relieved by their companions.
A light breakfast was served, no campfire being lit for fear the
smoke might attract the attention of the enemy.
It was well toward noon when White Buffalo came in, he and his
followers having had to make a wide detour, in order to escape
another encounter with Moon Eye. White Buffalo had been struck in
the left forearm by a tomahawk, an ugly but not a serious cut, and
one brave had received an arrow in the fleshy part of the leg.
“Do you think they are coming this way?” was Rodney’s first
question.
“There is no telling what they will do next,” answered the aged
Indian chief. “White Buffalo and his followers drew them as far
northward as possible—we could do no more. Rodney had better
travel eastward as fast as he can. In that direction alone lies safety.”
Without delay the march was once more begun, first to a fording
spot across the stream and then directly eastward. They moved
onward until long after sunset, covering at least fifteen miles, over a
broken deer trail that was rough in the extreme. On the way one
horse—that carrying Nell and little Tom—stepped into a hole and
went down, throwing both children into the bushes.
“Are you hurt, Nell?” asked Rodney, rushing up in alarm.
“I—I think not!” she gasped. “But I don’t like such tumbles at all!”
“Bad horse, to go down with Tom,” said the little boy.
“He couldn’t help it,” answered Rodney. “I am glad you are not
injured,” he added, heartily, and picked the boy up in his arms while
Nell arose unaided.
The horse was in a bad way, having broken his leg and dislocated
his shoulder. To put him out of his misery, Rodney had one of the
Indians kill him with several blows from a tomahawk. Then Nell and
Tom were placed on another horse, and the party went on as before.
The next day found them once more on the regular road. Not a
sign of the enemy had been seen and all began to breathe a little
easier.
“I think we are out of it at last,” said Rodney. “We are getting
pretty well on to the east now.”
“Right you are,” answered Casbury.
“That White Buffalo is a pretty good Injun after all, so he is,”
admitted Malloy.
They had now reached what in past years had been the foremost
of the homesteads along the army road. The places were burned
down without exception, only the blackened ruins showing where log
cabins and stables had stood. The owners had long since either fled
or been killed.
“It may be a long while before this is settled again,” said Rodney.
“Perhaps not, lad,” answered one of the frontiersmen. “As soon as
it is known the Indians are under control some folks will come out
again, and others will follow,” and this proved to be true. Inside of
three years there were more settlements along the Forbes and the
Braddock roads than ever before.
Feeling themselves fairly free from danger, they did not push
along quite so rapidly. This rested the horses and was also more
comfortable for Sam Barringford, who had suffered more than he
cared to admit.
“Rodney will not want White Buffalo any more,” said the aged
chief one morning, when they were within two days’ journey of Fort
Cumberland. “White Buffalo must go elsewhere.”
“Won’t you come home with me?” asked the young soldier. “Father
will be glad to see you, I know.”
“White Buffalo must attend to the affairs of his tribe,” was the
reply, and soon the aged chief departed with his followers, stating
that if it was possible he would stop at Fort Pitt and let James
Morris, Dave, and Henry know how they had come through without
great loss. Rodney thanked the Indian for all he had done and shook
hands warmly, and Barringford did the same. It was a long while,
and many startling things occurred, before they saw White Buffalo
again.
The thoughts of Rodney and his sister turned homeward now, and
both were anxious to see the old homestead once more. The twins
did not remember much, having been away so long, but they were
glad to get away from “the shooting Indians” as Artie called them.
It was a cold but clear day when the expedition reached Fort
Cumberland. Here the regulars reported, as they had been told to
do, and were properly discharged from further service in the army.
Rodney, Barringford, and the others also told their stories and
delivered a message sent by Colonel Bouquet, who was still near
Fort Pitt, trying to locate Pontiac.
All was now comparatively quiet around Fort Cumberland. To the
southward, a small band of Indians had appeared a few weeks
before and attacked some white and colored people, carrying two
colored girls, slaves of a Mr. Bowman, into captivity. To the
northward, the enemy had fallen on a band of Moravians while at
their devotions and slaughtered one of the leaders and two young
women. The Moravians were very bitter and wanted the English
army to drive the red men to the far west, beyond the Mississippi.
Leaving the others at Fort Cumberland, Rodney took the horses
and set off for the Morris homestead, in company with Barringford,
Nell, and the twins. The route was now familiar even to Nell, and
she watched eagerly for the first sign of the cabin.
“Papa! I see papa!” she cried, as they made a turn along the
brook road, and soon they saw Joseph Morris walking toward them,
rifle in hand, for none of the settlers thought of going out without
being armed.
“Rodney! and Nell!” burst from Joseph Morris’s lips, and he came
running up with a beaming face. He kissed his little daughter several
times. “Glad you are back! And you too, Sam,” he added to the old
frontiersman. “And how are the twins?” and he chucked them under
the chin.
“I am glad to be back,” said Rodney. “It seems like an age since I
went away and joined the soldiers.”
They did not stop to tell their story, for it was only a step more to
the log cabin. Mrs. Morris, the kindest of motherly women, came
rushing out of the door to greet them.
“Nell, my Nell!” she burst out, and hugged her daughter over and
over again, while the tears of joy streamed down her face. “Oh, how
glad I am that you are back!”
“And I am glad too, mamma,” said Nell. “Oh, it’s been such a very,
very long time since the Indians took me!”
“And Rodney!” went on Mrs. Morris, kissing his sunburnt cheek.
“How did you stand it? Didn’t the old lameness bother you?” And
then she hugged the twins and shook hands with Sam Barringford.
It was indeed a happy meeting all around.
“You must stay home, at least for the winter,” said Joseph Morris
to his son. “You have seen enough of peril for a time.”
“I am willing to stay home,” said Rodney. “But I think I ought to
join Uncle Jim and Dave and Henry in the spring.”
He told all the news that evening, sitting around the kitchen fire,
and Barringford and little Nell also told their tales. The old
frontiersman wanted to know if any letter had come from England
regarding the twins.
“Nothing as yet,” said Joseph Morris. “But it is something to know
that their father’s name is Maurice Hamilton, and that he is well-to-
do. Some day we shall probably hear from him.”
Much about the homestead had been destroyed by the Indians,
but Joseph Morris had worked hard to get things into shape again.
Family stores had been brought in, from Fort Cumberland and from
Annapolis, and the settler had cut a pile of wood for winter use.
“I hope all goes well with those left at Fort Pitt,” said Joseph
Morris. “It is said here that the Indians are very bitter out there.”
“They certainly are,” answered Rodney.
“It’s a pity Pontiac was not slain. He is the head and front of this
constant fighting. More than likely he will try to get up another
conspiracy before long.”
“Your neighbor, Jack Spader, just told me some news,” said Sam
Barringford, who sat on the doorstep, taking his ease in the
sunshine. “It is reported at Fort Cumberland that the Indians are
going to make another attack on Fort Pitt. Nobody seems to know
where the report started.”
“I trust it is not true,” replied Rodney.
“So do I,” added Mrs. Morris, “for the sake of Henry, and your
uncle, and Cousin Dave.”
“Well, they will have to do what they can to take care of
themselves,” said Joseph Morris. “Perhaps we shall have our own
hands full here this winter. The Indians have made no preparations
for cold weather, and rather than starve they may attack us.”

You might also like