Building Real-Time Marvels with Laravel: Create Dynamic and Interactive Web Applications 1st Edition Sivaraj Selvaraj pdf download
Building Real-Time Marvels with Laravel: Create Dynamic and Interactive Web Applications 1st Edition Sivaraj Selvaraj pdf download
or textbooks at https://ebookmass.com
_____ Follow the link below to get your download now _____
https://ebookmass.com/product/building-real-time-marvels-
with-laravel-create-dynamic-and-interactive-web-
applications-1st-edition-sivaraj-selvaraj/
https://ebookmass.com/product/getting-started-with-angular-create-and-
deploy-angular-applications-1st-edition-victor-hugo-garcia/
How To Create Wealth Investing In Real Estate: How to
Build Wealth with Multi-Family Real Estate
https://ebookmass.com/product/how-to-create-wealth-investing-in-real-
estate-how-to-build-wealth-with-multi-family-real-estate/
https://ebookmass.com/product/developing-web-components-with-svelte-
building-a-library-of-reusable-ui-components-1st-edition-alex-libby/
Sivaraj Selvaraj
Building Real-Time Marvels with Laravel: Create Dynamic and Interactive Web
Applications
Sivaraj Selvaraj
Ulundurpettai, Tamil Nadu, India
Introduction��������������������������������������������������������������������������������������������������������xxxiii
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
x
Table of Contents
xii
Table of Contents
xiii
Table of Contents
xiv
Table of Contents
xv
Table of Contents
xvi
Table of Contents
xvii
Table of Contents
xviii
Table of Contents
Chapter 19: Building Progressive Web Applications (PWAs) with Laravel����������� 477
Understanding Progressive Web Applications and Service Workers����������������������������������������� 478
Key Characteristics of Progressive Web Applications���������������������������������������������������������� 479
Service Workers������������������������������������������������������������������������������������������������������������������ 479
Converting Laravel Applications into PWAs������������������������������������������������������������������������������� 480
Set Up a Manifest File��������������������������������������������������������������������������������������������������������� 480
Offline Support and Caching Strategies for PWAs�������������������������������������������������������������������� 484
Offline Support�������������������������������������������������������������������������������������������������������������������� 485
Caching Strategies�������������������������������������������������������������������������������������������������������������� 486
Push Notifications and Background Sync in PWAs������������������������������������������������������������������� 488
Push Notifications��������������������������������������������������������������������������������������������������������������� 488
Background Sync���������������������������������������������������������������������������������������������������������������� 489
Optimizing PWAs for Performance and User Experience���������������������������������������������������������� 491
Performance Auditing���������������������������������������������������������������������������������������������������������� 491
Code Splitting���������������������������������������������������������������������������������������������������������������������� 491
Lazy Loading������������������������������������������������������������������������������������������������������������������������ 492
xix
Table of Contents
xx
Table of Contents
Enhancing User Experience with CSS Animation and Transition Effects���������������������������������� 506
CSS Animations������������������������������������������������������������������������������������������������������������������� 506
CSS Transitions�������������������������������������������������������������������������������������������������������������������� 507
Keyframe Animations���������������������������������������������������������������������������������������������������������� 507
Delicate Hover Effects��������������������������������������������������������������������������������������������������������� 508
CSS Transitions for Smooth State Changes������������������������������������������������������������������������� 508
Animation Timing Functions������������������������������������������������������������������������������������������������ 509
Use Animations Sparingly���������������������������������������������������������������������������������������������������� 509
Designing Accessible Applications with Laravel����������������������������������������������������������������������� 509
Semantic HTML������������������������������������������������������������������������������������������������������������������� 510
ARIA Roles and Attributes���������������������������������������������������������������������������������������������������� 510
Focus Management������������������������������������������������������������������������������������������������������������� 511
Alternative Text for Images�������������������������������������������������������������������������������������������������� 511
Form Accessibility��������������������������������������������������������������������������������������������������������������� 511
Color Contrast���������������������������������������������������������������������������������������������������������������������� 511
Test with Assistive Technologies����������������������������������������������������������������������������������������� 512
Accessibility Auditing Tools������������������������������������������������������������������������������������������������� 512
Provide Transcripts and Captions���������������������������������������������������������������������������������������� 512
Implementing User Feedback and Usability Testing in Laravel Applications���������������������������� 512
Feedback Collection Mechanisms��������������������������������������������������������������������������������������� 512
Error Reporting�������������������������������������������������������������������������������������������������������������������� 513
Analyze User Behavior��������������������������������������������������������������������������������������������������������� 513
Usability Testing������������������������������������������������������������������������������������������������������������������ 514
User Surveys����������������������������������������������������������������������������������������������������������������������� 514
Feedback Analysis and Action Plan������������������������������������������������������������������������������������� 515
Iterative Improvement��������������������������������������������������������������������������������������������������������� 515
Accessibility Testing������������������������������������������������������������������������������������������������������������ 515
Performance Testing������������������������������������������������������������������������������������������������������������ 515
User Support and Communication��������������������������������������������������������������������������������������� 515
Bug Tracking and Issue Management��������������������������������������������������������������������������������� 515
Summary���������������������������������������������������������������������������������������������������������������������������������� 516
xxi
Table of Contents
xxiii
Table of Contents
xxiv
Table of Contents
Enhanced SQL Server Query Performance with FETCH and OFFSET for Queries Without
orderBy������������������������������������������������������������������������������������������������������������������������������������� 620
Laravel Pennant������������������������������������������������������������������������������������������������������������������������ 621
Laravel Process Interaction������������������������������������������������������������������������������������������������������� 622
Pest Scaffolding������������������������������������������������������������������������������������������������������������������������ 624
Summary���������������������������������������������������������������������������������������������������������������������������������� 624
Index��������������������������������������������������������������������������������������������������������������������� 625
xxv
About the Author
Sivaraj Selvaraj’s work is focused on modern technologies
and industry best practices. His experience includes
frontend development approaches such as HTML5, CSS3,
and JavaScript frameworks, as well as creating responsive
web design to optimize user experience across devices. He
specializes in developing dynamic web applications with
server-side languages such as PHP, WordPress, and Laravel,
as well as managing and integrating databases with SQL and
MySQL. Sivaraj is enthusiastic about sharing his significant
expertise and experience, empowering readers to solve tough challenges and create
highly functional, visually appealing websites.
xxvii
About the Technical Reviewer
Yogesh Kamal Sharma is an application developer
enthusiast, consultant, and avid paperback reader. He is
presently associated with NICE Actimize to modernize
AML programs by bringing together machine learning and
domain expertise to combat money laundering and terrorist
financing. He graduated from VSIT Mumbai, is a father of
one, and enjoys his free time golfing.
xxix
Acknowledgments
I am indebted to my mentors and fellow developers in the Laravel community. Your
guidance, insights, and shared knowledge have been pivotal in my growth as a Laravel
developer. The open collaboration and spirit of learning in the community have inspired
me to strive for continuous improvement.
I extend my gratitude to the reviewers and editors who diligently reviewed and
refined the content, ensuring its accuracy and clarity.
To my friend Divya Modi, thank you for your unwavering camaraderie and
encouragement throughout this journey. Your insights and discussions have enriched
my understanding of book development as a whole.
To all the readers and supporters of this book, thank you for your interest in learning
and mastering Laravel. Your passion for growth and dedication to honing your skills
motivate me to share my knowledge and experiences.
This book would not have been possible without the contributions of each individual
mentioned here. Your belief in this project and your unwavering support have been
integral to its success.
With sincere appreciation
xxxi
Introduction
Welcome to Building Real-Time Marvels with Laravel: Create Dynamic and Interactive
Web Applications. This book will introduce you to the exciting world of Laravel, a
powerful PHP framework that allows developers to create cutting-edge web apps with
real-time functionality. Whether you’re a seasoned developer or just starting out, this
thorough tutorial will provide you with the knowledge and skills you need to create
remarkable and engaging web experiences with Laravel.
Because of its elegance, simplicity, and feature-rich environment, Laravel has
garnered enormous appeal in the online development community. It gives developers a
strong collection of tools and conventions that help streamline the development process,
letting them focus on creating novel features and great user experiences.
We will cover the Laravel framework in a logical and organized manner, chapter by
chapter, throughout this book. Each chapter delves further into the Laravel environment,
covering fundamental principles, advanced techniques, and best practices to help you
become an expert Laravel developer.
Our goal is to provide you with the knowledge and confidence you need to create
real-time miracles—online applications that engage users with dynamic information,
interactive interfaces, and seamless communication. This book will walk you through
the process of creating a real-time chat application, a collaborative dashboard that
displays real-time data, or any other interactive online application.
If you’re new to Laravel, don’t worry! We’ll start with an overview of the Laravel
ecosystem, covering its key principles, architecture, and vital components. You will learn
how to configure your development environment so that you have everything you need
to begin developing Laravel applications.
Fear not, those who are already familiar with Laravel! There are numerous advanced
topics available to challenge and extend your knowledge. This book covers a wide
range of subjects, from learning complicated routing strategies to fine-tuning database
interactions with Eloquent Object-Relational Mapping (ORM) to adding real-time
features with WebSockets to improving performance and scaling your applications.
Throughout the journey, you will experience practical examples, real-world use
cases, and hands-on exercises to help you understand the ideas covered. Each chapter
xxxiii
Introduction
builds on the one before it, steadily increasing the level of intricacy of the topics
discussed. By the end of this book, you will have the knowledge and confidence to create
sophisticated online applications that will astound users and advance your Laravel
developer career.
So whether you are a curious beginner or a seasoned developer seeking to unlock the
full potential of Laravel, fasten your seatbelt as we embark on this exhilarating journey of
building real-time marvels with Laravel. Let’s dive in!
Throughout the book, you’ll find practical examples of testing, security, and
integration with third-party services, empowering you to build impressive real-time web
applications using Laravel.
Development Environment
The development environment for this book includes
• PHP and Composer for the Laravel framework
xxxiv
Introduction
Chapters at a Glance
Chapter 1, “Understanding the Laravel Ecosystem”: In this introductory chapter, we’ll
take a closer look at the Laravel framework, learning its key features, architecture, and
philosophy that make it stand out among other PHP frameworks. You’ll discover how to
set up your development environment and get ready to embark on a journey through the
Laravel ecosystem.
Chapter 2, “Advanced Routing Techniques”: Routing is a fundamental aspect of any
web application, and Laravel provides a robust routing system. In this chapter, we’ll
delve into advanced routing techniques, such as working with route parameters and
wildcards, route model binding, and route caching. You’ll also explore how to group
routes using middleware to enhance code organization and maintainability.
Chapter 3, “Database Management and Eloquent ORM”: A crucial part of web
application development is managing databases effectively. Laravel’s Eloquent ORM
simplifies database interaction and makes querying and relationship management a
breeze. We’ll explore database migrations, learn how to create and modify tables, and
dive deep into Eloquent relationships, including one-to-one, one-to-many, and many-
to-many relationships.
Chapter 4, “Authentication and Authorization”: Security is paramount in any web
application. In this chapter, we’ll cover user authentication, including registration, login,
and logout functionality. Additionally, you’ll learn how to implement authorization, user
roles, and permissions using Laravel’s robust authentication and authorization systems.
Chapter 5, “Building APIs with Laravel”: APIs play a vital role in modern web
application development. In this chapter, we’ll explore the world of API development
with Laravel, including building RESTful APIs. You’ll discover how to handle API
authentication and security, rate limiting, and effective error handling to create robust
and reliable API endpoints.
xxxv
Introduction
xxxvi
Introduction
xxxvii
Introduction
applications into PWAs, and implementing offline support and caching strategies. We’ll
also explore push notifications and background sync for improved user engagement.
Chapter 20, “Advanced UI/UX Design Patterns for Laravel”: The user interface
and user experience are critical for the success of your application. In this chapter,
you’ll discover how to design user-friendly interfaces with Laravel’s Blade templating
engine, implement responsive design and mobile optimization techniques, enhance
the user experience with CSS animation and transition effects, and design accessible
applications. We’ll also cover user feedback and usability testing in Laravel applications.
Chapter 21, “Advanced Analytics and Reporting in Laravel”: Understanding user
behavior and application performance is essential for making informed decisions. In this
chapter, you’ll explore integrating analytics tools with Laravel, collecting and analyzing
application metrics and user behavior, building custom dashboards and reports,
and implementing A/B testing and conversion tracking. We’ll also discuss using data
visualization libraries with Laravel.
Chapter 22, “Advanced Third-Party Integrations”: Modern web applications often
rely on third-party services for payment processing, authentication, and more. In
this chapter, you’ll explore integrating Laravel with payment gateways, implementing
social media and authentication (OAuth) integrations, connecting Laravel with email
marketing services, integrating Laravel with cloud storage providers, and building
custom API integrations.
Chapter 23, “Securing Laravel Applications”: Security is a top priority in web
application development. In this chapter, you’ll learn how to implement two-factor
authentication (2FA) in Laravel, secure user input and form validation, prevent Cross-
Site Scripting (XSS) and Cross-Site Request Forgery (CSRF) attacks, and secure API
endpoints with API keys and rate limiting. We’ll also explore implementing Content
Security Policies (CSPs) and Secure Sockets Layer/ Transport Layer Security (SSL/TLS)
encryption for enhanced security.
Chapter 24, “Advanced DevOps and Infrastructure Automation”: Automating
infrastructure management and deployment pipelines is essential for efficient
development workflows. In this chapter, you’ll explore Infrastructure as Code (IaC) with
Laravel and tools like Terraform, automating deployment pipelines with Laravel and CI/
CD tools, implementing application monitoring and log management, and continuous
performance optimization and auto-scaling. We’ll also discuss building highly available
and fault-tolerant Laravel infrastructures.
xxxviii
Introduction
Chapter 25, “New Features and Updates in Laravel 10”: Laravel is continuously
evolving, introducing new features and improvements with each release. In this final
chapter, we’ll explore the latest updates in Laravel, ensuring you stay up to date with the
cutting-edge technologies and tools available for building real-time marvels.
Each chapter is thoughtfully crafted to equip you with practical knowledge and
real-world skills that you can immediately apply to your own projects. Throughout the
book, we provide hands-on examples and code snippets, ensuring you gain a clear
understanding of the topics covered.
Prepare to unlock the full potential of Laravel and embark on a journey of building
real-time marvels that leave a lasting impression on your users. Let’s get started!
xxxix
CHAPTER 1
1
© Sivaraj Selvaraj 2024
S. Selvaraj, Building Real-Time Marvels with Laravel, https://doi.org/10.1007/978-1-4842-9789-6_1
Chapter 1 Understanding the Laravel Ecosystem
Throughout this chapter, we aim to equip you with a solid understanding of the
Laravel ecosystem, setting the stage for deeper exploration and mastery in the chapters
to come. So let's begin this exciting journey into the world of Laravel!
2
Chapter 1 Understanding the Laravel Ecosystem
MVC Pattern
Routes: Routes define the URLs and corresponding controller actions. They map
incoming requests to the appropriate controller method.
Controllers: Controllers handle user requests and manage the flow of data. They
receive input from users, interact with models, and return responses. Controllers contain
methods (actions) that define the logic for each route.
Models: Models represent the data and business logic of the application. They
interact with the database and provide an abstraction layer for retrieving, creating,
updating, and deleting data. Models encapsulate the application's data structure and
define relationships between entities.
Views: Views are responsible for presenting data to users. They contain the HTML
templates and UI components that render the final output. Views can access data from
models and controllers to display information.
3
Chapter 1 Understanding the Laravel Ecosystem
4
Chapter 1 Understanding the Laravel Ecosystem
Install PHP
Download and install PHP 7.4 or higher from the official PHP website (www.php.net/
downloads.php). Verify the installation by running ‘php -v’ in the command prompt. You
should see the PHP version displayed.
Web Server
A web server is a piece of software that runs on a server computer and monitors
incoming HTTP requests from clients (web browsers). It processes these requests and
returns to the customers the necessary web pages or resources. Web servers that are
often used include Apache, Nginx, and Microsoft IIS.
5
Chapter 1 Understanding the Laravel Ecosystem
Database (DB)
A database is a systematic collection of data that has been arranged and stored in order
to be easily retrieved and manipulated. It is used to store and manage application data
such as user information, product details, and other information. Databases commonly
used in web development include MySQL, PostgreSQL, and SQLite.
Install a Database
Choose a database management system like MySQL, PostgreSQL, or SQLite and install it
on your machine. Create a new database for your Laravel application.
Configure the database connection in the Laravel ‘.env’ file.
For Illustration, refer to the following snippet:
---------------------------------------------------------------------------
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
---------------------------------------------------------------------------
Composer
Composer is a PHP dependency management tool. It makes it easier to manage
PHP packages and libraries in your project. It lets you declare the libraries on which
your project depends and then installs and updates them automatically, delivering a
consistent and reliable development environment.
6
Chapter 1 Understanding the Laravel Ecosystem
Install Composer:
Installation for Linux, Unix, or macOS
Users using Linux, Unix, or macOS can install Composer by following the instructions in
the URL provided (https://getcomposer.org/doc/00-intro.md#installation-linux-
unix-macos).
Install Laravel
Open a command prompt, navigate to the desired directory for your Laravel project, and
run the following command:
---------------------------------------------------------------------------
composer create-project --prefer-dist laravel/laravel your-
project-name
---------------------------------------------------------------------------
Replace ‘your-project-name’ with the desired name for your Laravel project.
Composer will download and install Laravel and its dependencies.
7
Chapter 1 Understanding the Laravel Ecosystem
---------------------------------------------------------------------------
php artisan key: generate
---------------------------------------------------------------------------
This command will produce a random key and store it in your Laravel project's .env
file, specifically in the APP_KEY variable. The key will resemble the following:
---------------------------------------------------------------------------
bash base64 copy code:QqRchgn5/23n+js1FIoMBy3V9T2tYsa9vnruOHdr2Ns=
---------------------------------------------------------------------------
Keep the application key private and avoid distributing it publicly or storing it in
version control repositories. If you need to regenerate the key for whatever reason,
simply run the key:generate command again, and a new key will be generated and saved
in the .env file.
---------------------------------------------------------------------------
php artisan serve
---------------------------------------------------------------------------
8
Chapter 1 Understanding the Laravel Ecosystem
Routing
Routing in Laravel refers to defining how incoming HTTP requests should be handled.
Routes define the URLs and map them to specific controller actions. For example, you
can define a route that maps the "/users" URL to a UserController's index action. Routes
provide a clean and expressive way to handle different HTTP methods (GET, POST, PUT,
and DELETE) and parameters.
For Illustration, refer to the following snippet:
---------------------------------------------------------------------------
Route::get('/users', 'UserController@index');
---------------------------------------------------------------------------
CRUD Routing
Let's now create CRUD (Create, Read, Update, Delete) routes for managing blog posts:
---------------------------------------------------------------------------
// routes/web.php
use App\Http\Controllers\BlogController;
// Show the list of blog posts
Route::get('/posts', [BlogController::class, 'index']);
// Show the form for creating a new blog post
Route::get('/posts/create', [BlogController::class, 'create']);
// Store a newly created blog post
Route::post('/posts', [BlogController::class, 'store']);
// Show a specific blog post
Route::get('/posts/{id}', [BlogController::class, 'show']);
// Show the form for editing a blog post
Route::get('/posts/{id}/edit', [BlogController::class, 'edit']);
9
Chapter 1 Understanding the Laravel Ecosystem
In the preceding example, we constructed routes for complete CRUD actions on blog
posts. These pathways correspond to the actions listed in the following:
index: This function displays a list of all blog posts.
Controllers
Controllers in Laravel are responsible for handling user requests and managing the flow
of data in the application. Controllers contain methods, also known as actions, that are
invoked when a specific route is accessed. They receive user input, interact with models
and services, and return responses to the user. Controllers help separate the logic of an
application from the routing layer.
For Illustration, refer to the following snippet:
---------------------------------------------------------------------------
class UserController extends Controller {
public function index() {
$users = User::all();
return view('users.index', ['users' => $users]);
}
}
---------------------------------------------------------------------------
10
Other documents randomly have
different content
CHAPTER I
He went to a Dame’s school, where his first teacher said that she
had never had so troublesome a pupil, that his head was like a
colander; but Harry puts the case more pathetically when he tells his
mother that ‘Mrs. Harris says if we go on, we shall kill her, and we
do go on,’ regretfully adding, ‘and yet she does not die.’ A
schoolmate of these days says that Harry lisped very much, and that
the boys used to tease him about it. He was also so slow about his
lessons that they called him thickhead. But when school was out
Harry entered the realms he loved. From his home on the market-
place he had only to go outside the door to be at once in touch with
the active world whose economic problems appealed to him so
keenly. He made friends among the country folk, and talked of their
crops and the money they would bring, and noted in his childish
mind the rise and fall in the price of wheat.
The Circus. Then to the same open space came all sorts of
travelling shows. Sometimes the circus spread its
mysterious tents, and when the children were dragged away from
the wild beasts and the seductive freaks and put to bed, the little
Fawcetts would stealthily creep to the bedroom window overlooking
the market and see the lights shining on all the wonderful but
forbidden marvels, and hear the hurdy-gurdy and the band mix their
triumphal blare with the solemn striking of the clock in the near-by
cathedral.
Boarding- In 1841 Harry’s father took a delightful farmhouse at
School. Longford, about three miles south of Salisbury, with
delectable streams full of fish. Harry loved to fish
every day, and hated lessons, but, alas! grim fate backed the
lessons, and sent him ruthlessly to school. He went as a boarder to
Mr. Sopp at Alderbury, a few miles away.
There are many tales showing that Harry loved the fleshpots and
that he had been much indulged at home. He writes, ‘I have begun
Ovid—I hate it.’ ‘This is a beastly school—milk and water, no milk—
bread and butter, no butter. Please give a quarter’s notice.’
And still more heartrending was the prayer to his mother, ‘Please
when the family has quite finished with the ham bone, send it to
me.’ Imagination can supply the effect of this on the family circle,
and guess what a well-covered ham bone was shipped to the
starving Harry. Starving or no, he grew immensely stronger and
larger, and though he never admitted that he got enough to eat at
any school, he became ultimately reconciled to his exile.
He used to come home often for half-holidays, and to go to Longford
and revel in all country delights. Then began the close friendships
with the cottagers about him which meant so much to him and
influenced all his life.
In the summer that completed his tenth year there came to
Salisbury two men who also loved the common people and sought to
make their lives easier. It was the year of the great Free Trade
campaign in the agricultural districts, and the men were Cobden and
Bright. They visited Harry’s father, and perhaps Harry himself met
them then for the first time. Lord Morley has said in his life of
Cobden that ‘the picture of these two men, leaving their homes and
their business, and going over the length and breadth of the land to
convert the nation, had about it something apostolic.’ In a home
where they and their teachings were so reverenced, to even hear of
their journeyings would make a strong impression on a boy of
Harry’s interests, and perhaps helped to give a definite aim to his
ambitions.
At Mr. Sopp’s school he began a diary, of which the penmanship is
admirable. On some days the only record is the startling fact, ‘It was
a very fine day.’ June 21st, 1847, however, is a very eventful day, for
he lists the capture of the first fish that he took with a fly, which
weighed ‘about three-quarters of a pound.’
Hedgehogs Again, he is transported with joy by the gift of a
and Cake. hedgehog and four young ones, and he has a
glorious time in going on board H.M.S. Howe, of one
hundred and twenty guns. On one occasion he goes to the theatre,
on another he is in court hearing a trial. He begins Greek, and this
anguish is modified by the arrival of a cake for one of his
schoolfellows, which Harry doubtless shares.
A change of scene is recorded in the diary when on 3rd August
Henry becomes the first pupil at Queenwood College. In its previous
career this temple of learning had been Harmony Hall, built by
Robert Owen for his last socialist experiment. In 1817 it was opened
as a school by Mr. Edmonson, a Quaker. Special emphasis was given
to scientific training and English literature. The school seems to have
been very congenial to Harry, and his intellect now began to develop
rapidly.
The Editor. To continue from the diary, we learn that ‘we elected
the various school officers. J. Mansergh and I were
elected without opposition editors of the Queenwood Chronicle.’ He
had been at Queenwood but a fortnight, and was fourteen years old
when this great honour came to him. Mr. Fawcett was delighted at
this good news, and offered because of it and because Harry had
been ’studying most determinedly’ to take the boy to Stonehenge.
His aversion to books had distressed his family, and this new interest
in his studies gave his father great pleasure. On reading a
composition which Harry had sent home, Mr. Fawcett exclaimed to
his wife, ‘I really think, mother, after all that there is something in
that boy!’ His literary performances at this time indicate an
increasing imagination, but in the main he never deviated from the
practical paths of thought shown when as a tiny child he studiously
investigated the Salisbury market. His schoolmates report him as ‘tall
for his age, loose-limbed, and rather ungainly.’ He had become much
of a bookworm, and though later good at games, at this time he
preferred to wander off by himself and read. He was strongest in
mathematics; languages did not much appeal to him; but he liked to
learn long passages of poetry by heart. There was a disused chalk-
pit near Queenwood where he would take refuge and declaim his
lines. The extravagance of his gesticulations might well cause
unexpecting passers-by to consider him the village loony.
CHAPTER II
=================================
A Lecture delivered by H. Fawcett
On Uses of Steam
At Queenwood College
September 27, 1847.
=================================
The ink, which was black sixty-six years ago, is now much faded; but
the essay of the fourteen-year-old schoolboy is still fresh and
interesting, and so prophetic of the man that it is like a simple map
indicating the chief features of the country we are about to see.
Henry writes in his careful penmanship, for which he must have
been marked at least 9+ in a scale of 10, ‘Things which appear
simple to an unobserving Person are to an observing Person the
most complicated and beautifully formed ... such a simple Thing as a
blade of Grass, has ever any Man been yet so wise as to tell what it
is?’
The Essayist. Here is another curious sentence written by the
bright-eyed youngster with the monumental dignity
of the lecturer:
‘What can be so beautifully contrived and framed as the human
Body, where there are innumerable Parts, acting all in Unity?... if one
of the Parts go wrong, the whole Body is put out of Tune ... is there
any one Part of our Body which we could dispense with?... I think
the Answer “No” must be evident to every one.’
It is curious that Fawcett should have been called upon later by the
loss of his eyesight to contradict this childish statement, and to
prove not only that we can get along without some of our most
precious faculties, but that the law of compensation so works that
we may be able to accomplish more by reason of the loss.
The essay proceeds to deal with railways, and contains all kinds of
figures relating to tonnage, trains, traffics, the cost of railroad
construction, etc., all with careful, correct figures; a complicated
study for a railroad expert. This schoolboy is already coping with the
figures and statistics of which he had later such a marvellous
control. He dwells on the importance of the railroad to the Wiltshire
farmer, who can sell his cheese at sevenpence a pound in London,
when it is only worth sixpence where it is made. In this and similar
statements we find the political economist foreshadowed: he speaks
of the nobility who selfishly object to having railways, which he feels
are the greatest help to the common people; and he adds, ‘A Man
should sacrifice a little of his own Pleasure when he knows that by
sacrificing that Pleasure he will benefit the People at large.’ We must
note that pleasure is always spelt with a beautiful and exceptionally
large P.
Later there are some intelligent remarks on the power of a railway to
create traffic, so that ’some Railways have been made between two
Places where there was not sufficient Traffic for a Coach, and yet
when they are made, a Trade springs up, and they pay very well
indeed.’
Transporta- He further approves of the railway as a means of
tion—Rich and cheap transportation, and remarks, ‘Many a Person
Poor. can avail himself of a Day’s Pleasure ...’ or, ‘Enjoy the
beautiful Air of some Country Village.’ Here we have not only the
keystone of Henry Fawcett’s character, but indications of the political
activities in which he was to be so pre-eminent. His public career
was one long, unbroken effort to do away with the monopolies and
prerogatives of any class, and so to increase the independence and
rights of the poor.
The essay continues by quoting from an article in the Quarterly
Review written in 1825, which considers it impossible that an engine
could travel eighteen miles an hour. With evident joy he quotes, ‘The
gross Exaggerations of the Powers of the Locomotive Steam Engine,
or to speak English, the Steam Carriage, may delude for a time, but
must end in Mortification to those concerned. We should as soon
expect the People of Woolwich to suffer themselves to be fired off in
Congreve’s Ricochet Rockets, as to trust themselves to the Mercies
of such a Machine going at such a rate.’ Harry himself then tells of
the M.P. who insisted that the best possible locomotive could not
compete with a canal boat. The scribe seems fully to appreciate the
humour of this, and so foreshadows the love of fun and the vibrant
laugh of the man to be.
Steam-engines lead to steamships. Our author now invites us to
cross ‘the wide heaving Ocean,’ saying, ‘When you are on a Voyage
in a Steam Vessel you feel none of that Inconvenience of having to
remain at Anchor for two or three Weeks waiting for a favourable
Wind ... you can proceed, for you are quite independent of the
Winds, and the Speed of a Steam Vessel is very considerably greater
than that of any other Vessel.’ A steam vessel went from Liverpool to
Boston in eleven days and nine hours, and yet when steam
navigation was struggling into existence ‘it struck the minds of our
brave Captains as a poor mean mechanical Thing unworthy of the
least Consideration.’... ‘I think you may almost remark’ (note the
conservative discretion) ‘that the greatest and most useful inventions
when they are struggling into Existence receive the greatest
Opposition, because they make great changes, and most people,
especially the ignorant, are generally very adverse to any changes.’
Patriotism— Now he boasts magnificently about the British navy
Bonaparte and and merchant marine, approves of Bonaparte’s
Babylon. wisdom in coveting the British sailors, and yet
prudently warns all against pride, citing the lamentable consequence
of lack of humility to Babylon and Nineveh. We are asked to consider
the relative values of coal, diamonds, gold, and silver, and are
informed that ‘every Difficulty can be overcome by steady
Perseverance—some Persons will never scarcely be overcome by
Difficulties—they say they will do it, and they will never rest till they
have performed what they want to, and it is to Men like these that
we are indebted.... No Improvements or Inventions will run into a
Person’s Mind like Water will run into a Bottle, but they come from
Years of Study and Perseverance.’
We are asked, ‘Do you suppose that Sir Isaac Newton established
the Laws of Gravitation without some trouble, do you suppose that
such a Piece of Poetry as Milton’s “Paradise Lost” was written
without a Moment’s Thought—or do you suppose that Watt improved
the Steam Engine without some hard Labour?’ Our scribe then
finishes his masterpiece with a stupendous finale, by the help of a
bit of poetry culled from an American newspaper and entitled the
’song of Steam,’ a verse of which will be sufficient:
‘I’ve no Muscle to weary, no Breast to decay,
No Bones to be laid on the “Shelf,”
And soon I intend you may go and play,
While I manage the World by myself.’
The new Harry knew that for his father’s sake it was necessary
Under- for him to be self-supporting as soon as possible, and
graduate. therefore chose his college on purely financial
grounds. He went to Peterhouse, where the fellowships could be
held by laymen, and were reported to be of unusual value.
His great friend, Sir Leslie Stephen, saw him there for the first time.
We cannot do better than quote from Sir Leslie’s biography of
Fawcett the impression his subject then made upon him:
‘I saw Fawcett for the first time a few months after his entrance (in
October 1852).... I could point to the precise spot on the bank of the
Cam where I noticed a very tall, gaunt figure swinging along with
huge strides upon the towing path. He was over 6 feet 3 inches in
height. His chest, I should say, was not very broad in proportion to
his height, but he was remarkably large of bone and massive of
limb.
‘The face was impressive, though not handsome. The skull was very
large; my own head vanished as into a cavern if I accidentally put on
his hat. The forehead was lofty, though rather retreating, and the
brow finely arched.
‘The complexion was rather dull, but more than one of his early
acquaintance speaks of the brightness of his eye and the keenness
of his glance. The eyes were full and capable of vivid expression,
though not, I think, brilliant in colour. The features were strong, and,
though not delicately carved, were far from heavy, and gave a
general impression of remarkable energy. The mouth long, thin-
lipped, and very flexible, had a characteristic nervous tremor as of
one eager to speak and voluble of discourse....
‘A certain wistfulness was a frequent shade of expression. But a
singularly hearty and cordial laugh constantly lighted up the whole
face with an expression of most genial and infectious good-humour.
[3-1]
‘He rather resembled some of the athletic figures who may be seen
at the side of a north-country wrestling-ring. Indeed, I fancy that
Fawcett may have inherited from his father some of the
characteristics of the true long-legged, long-limbed Dandie Dinmont
type of north-countryman. The impression was, no doubt, fixed in
my mental camera because I was soon afterwards surprised by
seeing my supposed rustic dining in our College Hall. I insist upon
this because it may indicate Fawcett’s superficial characteristics on
his first appearance at Cambridge.
‘Many qualities, which all his friends came to recognise sooner or
later, were for the present rather latent, or, maybe, undeveloped.
The first glance revealed the stalwart, bucolic figure, with features
stamped by intelligence, but that kind of intelligence which we
should rather call shrewdness than by any higher name.’
Sports and At first the men of his own year were inclined to
Games. estimate Harry as an outsider in sports and games.
His simple provincial ways gave little sign of expert
skill. But he won his way in dramatic fashion. An undergraduate nick-
named the ‘Captain’ challenged him to a game of quoits. Salisbury’s
native game is quoits; Harry was well trained, and won easily. Then
the battle shifted to billiards. Captain’s score pushed steadily ahead
until in a game of a hundred points he had ninety-six to Harry’s
seventy-five: four points more for the Captain, twenty-five for Harry.
The onlookers vociferously offered ten to one on the Captain.
Fawcett gravely took all the bets offered at this rate, and any others
that he could get, and then calmly, in a single break, made the
twenty-five necessary points.
A successful Fawcett is quoted as having given this account, ‘Bets
Game of were forced on me; but the odds were really more
Billiards. than ten to one against my making twenty-five in any
position of the balls, but I saw a stroke which I knew that I could
make, and which would leave me a fine game.’ No matter by what
magic the feat was achieved, it filled his pockets, and cleared for
ever any doubts in his companions’ minds as to the capacity and
shrewdness of ‘Old Serpent,’ as he was then dubbed, and by which
nickname he went for a brief time.
He never gambled again. The story is paralleled in later years by an
equally solitary financial speculation. He then showed the same
quickness in seizing the facts and calculating the chances, the same
boldness in acting on his own judgment, and the same restraint in
not repeating the adventure.
He disapproved of gambling, and had a wholesome dislike of it. His
sense of fun made it impossible for him ever to have a holier-than-
thou attitude, but his common sense and natural goodness kept him
singularly free from the failings so common among his associates.
While anything but a Puritan, he ‘was in all senses perfectly
blameless in his life.’
Making He had a rare talent for friendship, attracting people
Friends. to him as easily as he was attracted to them, and his
faculty of making friends and keeping them held to
the end. He was never known to lose a friend.
Those who knew him well appreciated his strong intellectual
equipment. Perhaps his chief characteristics were his absolute
normality, his remarkable freedom from self-consciousness, his
common sense, and his ever-present sense of fun. These early years
at the university, when the lank boy was emerging into the
statesman, were years of great happiness and joviality. Fawcett
found many congenial spirits, and formed intimacies among men
destined to distinguished careers. Most of his associates were good
workers, but not particularly given to intellectual subtleties. Music
made slight appeal to him, and he was flagrantly ignorant of classics
and modern languages, and made no pretence to culture. The young
Cambridge men of this period were greatly afraid of sentimentality,
and devotees of the ‘God of Things as they are.’
But there was one subject peculiarly attractive to the men with
whom Fawcett consorted—political economy. And in those days
political economy meant Mill. His book, gathering together all the
last words of the science, had been written a very few years before
Fawcett went to Cambridge. It had had a phenomenal success, and
it and its author were enjoying a phenomenal authority. Edward
Wilson, a brilliant Senior, well represented the feeling of his day,
when he would confute all opposition by an apt quotation, leaving
Mill triumphantly supreme, and then close his vindication with the
cry, ‘Read Mill! Read Mill!’ Fawcett did, from early till late, until he
knew the book by heart. As he was thoroughly inoculated with this
cult, his reverence for Mill was one of his strong steadfast beliefs
through life.
Fawcett begrudged time taken from his books, and never rowed in
his college boat, although Sir Leslie Stephen writes:
Boating. ‘That he occasionally performed in the second boat, I
remember by this circumstance, that I can still hear
him proclaiming in stentorian tones and in good vernacular from an
attic window to a captain of the boat on the opposite side of the
quadrangle, and consequently to all bystanders below, that he had a
pain in his inside and must decline to row. I have some reason to
think that he had felt bad effects from some previous exertions, and
had been warned by a doctor against straining himself. I have an
impression that there was some weakness in the heart’s action.
Fawcett, like many men who enjoy unbroken health, was a little
nervous about any trifling symptoms. One day we found him lying in
bed, complaining lustily of his sufferings, and stating that he had
dispatched a messenger to bring him at once the first doctor
attainable. A doctor arrived, and his first question as to the nature of
Fawcett’s last dinner resolved the consultation into a general
explosion of laughter, in which the patient joined most heartily.’
It was characteristic of Fawcett that he treated all men as equals,
and took from them the best of what they had to offer. He became
intimate with men of all ages. Mr. Hopkins, a Peterhouse man, with
whom Fawcett read, had received his B.A. in 1827, twenty-five years
before Fawcett’s appearance at Cambridge; but this difference in age
did not prevent a close bond. Fawcett never alluded to Hopkins
without great enthusiasm, and in the days of his grave trial this
friend was the most helpful of all. He was of great service in the first
years at Cambridge, urging Fawcett to regard the mathematical
studies necessary for taking a good degree as valuable intellectual
gymnastics. Fawcett with his usual keenness and common sense was
quite alive to the fact that a good degree was a distinct commercial
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookmasss.com