Getting started with CodeIgniter 4, master the basics of the PHP framework for beginners
Minimum price
Suggested price

Getting started with CodeIgniter 4, master the basics of the PHP framework for beginners

Here begins your roadmap in the use of PHPs frameworks

About the Book

This book is for anyone who wants to build their first applications in CodeIgniter 4, this writing offers a step-by-step introduction to the framework, knowing the most relevant aspects of it and is focused above all on practice; It is assumed that the reader has knowledge and has developed in PHP and related technologies of the language, such as JavaScript, HTML and CSS, since, remember that to use any framework, you have to have the bases that support it, that is, your programming language.

The book is aimed at those people who want to learn something new, learn about a framework that has very little documentation, who want to improve a skill in web development, who want to grow as a developer and who want to continue scaling their path with other frameworks superior to this one. As long as you meet at least some of the above considerations, this book is for you.


This book has a total of 21 chapters and consists of explanations and practices.


  1. This chapter is intended to explain the environment needed to develop in CodeIgniter 4.
  2. We take the first steps with the frameworks, we will know the official website of the framework, installation forms and advantages of each one of them, we install the framework, we will know the initial aspects on how to run the framework, configure a database, create our first components, the use of migrations for table management and we will see several cases on how to work with them, we will work with the MVC and create each of these components that define it from scratch, routing and of course, finishing the chapter with the traditional CRUD for one of our entities.
  3. It is a practice for you, in which you have to create another CRUD; putting into practice everything seen in the first chapter.
  4. You will know how to use the routes, grouped routes, their options and the different types.
  5. We will know the use of the session and also of the flash session to save data and present it to the user.
  6. You will learn to manage views in a reusable way.
  7. We will see how to use a more modular scheme when defining controllers for each type of module.
  8. We will know how to work with HTML forms and apply validations from the server side in CodeIgniter, knowing the types of validations, creating them and applying validations from the controller; to then finally show the errors by the view; we will also learn how to use helper functions particular to forms.
  9. We will learn more about models, some properties that we can define in them, the use of functions and common example cases.
  10. We will learn to use filters to intercept requests; as a practical case, we will create an authentication module with login for our application in which we will protect the management module or dashboard.
  11. In this chapter we build a Rest Api type CRUD that can be consumed with JSON or XML; being CRUD type operations and working mainly from the server side; It will be a process similar to the CRUD that we created in Chapter 2, but with some variations that are typical of this type of structure.
  12. In this chapter you will learn to generate test data with seeders which are ideal for when we are starting to develop.
  13. In this chapter we will learn how to handle the relational schema of the database in CodeIgniter; We will look at one-to-many and many-to-many relationships.
  14. In this chapter we are going to work with uploading files in our application, to upload images to our movie model.
  15. This chapter provides an introduction to the use of the libraries and help functions and how to use them.
  16. This chapter we will adapt Bootstrap 5 components in the application.
  17. This chapter we will create an end user module with list and detail page.
  18. This chapter we will make some changes in the Rest Api created previously to define additional methods such as upload, pagination, among others.
  19. App with Vue, coming soon.
  20. In this chapter we will learn how to integrate the PayPal platform in CodeIgniter, in order to process payments directly from the application.
  21. This chapter we will know how to integrate CodeIgniter shield to handle authentication and authorization; also, we will create a small project with which we will learn to manage groups and permissions.

By the end of the book, you will have the knowledge to create any basic application with the framework and know more than just the basics of it.

I invite you to visit my website:

And get to know my work.

This book is a translation into English of Primeros pasos con CodeIgniter 4, domina las bases del framework PHP para principiantes which was originally written in Spanish.

About the Author


Andrés Cruz Yoris, Licenciado en Computación, con más de 10 años de experiencia en el desarrollo de aplicaciones web en general; trabajo con PHP, Python y tecnologías del lado del cliente como HTML, JavaScript, CSS, Vue entre otras; y del lado del servidor como Laravel, Flask, Django y Codeigniter. También desarrollo con Android Studio, xCode y Flutter para la creación de aplicaciones nativas para Android e IOS.

Pongo a tú disposición parte de mi aprendizaje, reflejado en cada una de las palabras que componen mis libros sobre el desarrollo de aplicaciones en general.

Table of Contents

  • Chapter 1: Required Software and Installing the Tools
    • Windows
    • Mac
    • Linux
    • Composer
  • Chapter 2: Knowing general aspects of Codeigniter 4
    • Organization of a project
    • Model view controller
    • Spark The command line
    • Download and install CodeIgniter
    • Run the app
    • Getting started with CodeIgniter 4
  • Chapter 3: CRUD for categories
    • Controller
    • Views
    • Models
    • Routes
  • Chapter 4: Routes and redirects
    • Group routes
    • Redirects
    • Named routes
    • Redirects and named routes
    • Limit resource paths or presenter:
  • Chapter 5: Session and flash messages
    • Flash messages
    • Messages session
  • Chapter 6: Views
    • Views and layouts
  • Chapter 7: Controllers
    • Reorder Controllers
    • Private methods
  • Chapter 8: Forms
    • Validations
    • Previous value (old)
  • Chapter 9: Models
    • Model Properties
    • Changes to return types
  • Chapter 10: Filters
    • Create a filter
  • Chapter 11: Rest Api CRUD
    • Case study
    • Return json in controllers
  • Chapter 12: Seeders
    • Generate a seeder:
    • Nested seeders
  • Chapter 13: Relationships
    • One-to-many relationships
    • Many-to-many relationships
  • Chapter 14: Uploading files
  • Chapter 15: Libraries and helper functions
    • Case study

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub