Why Web Frameworks?
Picture building Lendly, a small app where neighbours lend each other books. Before you write a single line about books or loans, you already need URLs that map to code, logins that remember people, forms that reject bad input and a safe way to talk to the database. Every web app needs those same pieces. A framework is where they come pre-built.
The rule
A framework solves the repeated jobs so you solve the unique one.
Almost every web app repeats the same chores:
- Routing: turning
GET /books/42into "run the code that shows book 42". - State: sessions and cookies so the app remembers who is logged in.
- Data: reading and writing database rows without hand-built SQL strings.
- Safety: escaping output, hashing passwords, blocking forged form posts.
- Structure: an agreed place for each kind of file.
Written by hand, each chore is easy to get nearly right, and "nearly" is where security holes live. Laravel is a PHP framework that ships tested answers for all of them. Here is a whole route in Laravel:
Route::get('/books', function () {
return view('books.index', ['books' => Book::all()]);
});One line picks the URL, one line fetches every book, and the view escapes the titles before they reach the browser. In plain PHP that same page would mean parsing the URL yourself, opening a database connection, looping over results and escaping each value by hand.
A framework also gives you conventions. Controllers live in app/Http/Controllers, views in resources/views. A developer who has seen one Laravel app can find their way around yours on day one.
The shortcut
When you meet any feature, sort it into one of two piles: "every app needs this" or "only my app needs this". The first pile is the framework's job. The second pile is yours.
Members log in
Every app with accounts needs this. Framework pile: Laravel's authentication.
The trap is thinking a framework limits you. It only replaces the chores. Your own rules still go wherever you want them.
Drills
Answer fast — trust the rule.
Which of these is a Lendly-specific rule rather than a framework job?
What does a framework's set of conventions mainly buy a team?
Why is hand-writing security features risky?
In the route example, what does Book::all() do?
Remember
- A framework solves the repeated jobs so you solve the unique one.
- Sort each feature: "every app needs this" goes to Laravel, "only my app" goes to you.
- Trap: frameworks replace chores, not your own rules.
