Himanshu SharmaSoftware engineer
Let’s talk

CodeIgniter 4 · Lesson 30 of 30

CodeIgniter final project: review a complete bookshop boundary

Review the integrated fictional bookshop, deny external writes and document the exact verified behavior and unfinished production responsibilities.

15 minDelivery and final projectUpdated 14 November 2026

Awaiting technical review. This lesson is readable but not yet listed in search engines.

By the end of this lessonReview the integrated fictional bookshop, deny external writes and document the exact verified behavior and unfinished production responsibilities.

After this lesson you can review the whole fictional bookshop as a coherent application and present a read-only demonstration without claiming unfinished administrative features are production-ready. The final project is an integration exercise: explain how each boundary works, verify it and name what remains outside the project.

Assemble the application you have built

The schema consists of books with id and title. The migration creates it and the seeder supplies fictional records. BookModel maps it to arrays. Books coordinates list, detail and local form actions. Child templates extend layouts/main and escape data where it enters HTML.

The Api namespace contains a ResourceController for catalogue reading. Its public route declaration exposes only index and show. The optional create method is tested through temporary test routes and is not publicly mapped. Covers stores validated image uploads privately, but no book association or download endpoint is claimed.

text
app/Config/Database.php -> isolated SQLite connection
app/Database/Migrations/2026-11-14-000001_CreateBooks.php -> schema
app/Database/Seeds/BookSeeder.php -> fictional records
app/Models/BookModel.php -> data boundary
app/Controllers/Books.php -> browser actions
app/Controllers/Api/Books.php -> resource responses
app/Controllers/Covers.php -> private local upload exercise
app/Views/layouts/main.php -> shared document shell
app/Filters/CatalogueReadOnly.php -> explicit deny-all boundary

This is the project's assembly map. Compare it with your actual files. Do not create duplicate migrations or copy every intermediate demonstration controller alongside its replacement. Earlier demo templates can remain unused, but their routes should not become accidental alternate entry points.

Close the external write surface

Before sharing the demonstration, replace the local POST declarations with the following denied versions. Keep the existing GET catalogue routes and the restricted resource declaration. These are replacement lines, not extra duplicate routes.

php
$routes->post('books', 'Books::create', [
    'filter' => [\App\Filters\CatalogueReadOnly::class, 'csrf'],
]);
$routes->post('books/(:num)', 'Books::update/$1', [
    'filter' => [\App\Filters\CatalogueReadOnly::class, 'csrf'],
]);
$routes->post('books/(:num)/delete', 'Books::delete/$1', [
    'filter' => [\App\Filters\CatalogueReadOnly::class, 'csrf'],
]);
$routes->post('covers', 'Covers::create', [
    'filter' => [\App\Filters\CatalogueReadOnly::class, 'csrf'],
]);

These routes were loaded and checked in the temporary application. Deny-all runs before the ordinary mutation path, returning 403. The underlying local CRUD code remains an exercise, but external callers cannot use those routes to modify the demonstration. This is not a substitute for implementing a real editor identity and permission system later.

The new-book GET page is unnecessary in a read-only presentation. You can omit its route and navigation invitation when packaging the demonstration. Removing that page is a clarity choice; the denied POST boundary is what prevents the write. Hiding the form alone would not be sufficient.

Verify the integrated behavior

Run the catalogue feature suite and inspect the route map. The focused suite checks seeded reads, missing resources, escaping and the demonstration filter. Direct HTTP checks additionally verified form rejection, accepted local updates and deletion, plus accepted PNG and rejected text-file uploads before writes were denied.

bash
php spark routes
vendor/bin/phpunit --no-coverage --filter CatalogueTest

Example output captured on 2026-11; yours will differ. This selected result omits the route table and incidental test timing.

text
OK (6 tests, 10 assertions)

After switching to denied writes, make rejected requests and confirm database and upload storage remain unchanged. Do not interpret the earlier local success checks as the expected behavior of the final read-only configuration. They verify different deliberate states of the same learning application.

Explain the request without looking at the code

For a detail page, describe method-and-path matching, model lookup, missing-record handling, child-view rendering and contextual escaping. For JSON, describe the restricted route map and serialized response. For a rejected write, identify the before filter that stops the action.

If you cannot explain a component, simplify it before adding features. The project is small so that every boundary is visible. Adding payments, customer records or stock reservations would require new domain rules and a separate security and operational review.

State the remaining work honestly

Shield is described but not installed. Editor authentication, authorization and account recovery remain future work. Covers are privately stored but not attached to records or served. Pagination, moderation, concurrency policies and host-specific recovery are not completed features. The deployment lesson rehearsed local dependency preparation, not a production launch.

The fetched official CodeIgniter User Guide sections on routing, filters, models, views and testing support the integrated mechanisms. The completed artifact is a fictional learning catalogue with verified local exercises and a denied external write surface. It makes no claims about real users, traffic or commercial results.

Common mistakes

Calling the project a complete online shop invents purchasing and inventory features. Keeping duplicate route declarations makes review confusing. Sharing local mutation routes before authentication exposes unfinished administration. Finally, deleting limitations from the project notes does not implement the missing work; it only makes the demonstration harder to assess accurately.

Exercise

Prepare a review note covering one read journey, one rejected write and one rendering safety check. Include the actual installed version, the database isolation boundary and the missing features that must remain blocked before a public editor is introduced.

Show an answer

A useful note identifies CodeIgniter 4.7.6 as verified as of 2026-11, traces a seeded detail request, confirms a denied POST leaves data unchanged and references the escaped-title test. It states that SQLite is disposable private storage and that editor identity, authorization, cover association and host-specific deployment remain unimplemented or unverified.

Previous lesson · Related: explicit routes · Related: security boundaries

Key points

  • The project integrates a small model-backed catalogue and read-only JSON API.
  • Final route replacements deny external mutations before controllers run.
  • Authentication integration, cover serving and live deployment remain outside the completed exercise.

Check yourself

1. What is the final external mutation policy?
2. Does the project include a complete online shop?
3. Why distinguish local and final route states?

Final exam and certificate

Finish all 30 lessons to unlock a 15-question exam on CodeIgniter 4. Pass it and you get a certificate with a public link you can share.

Sign in to take the exam