
Learn to build a dynamic PHP and MongoDB project with AJAX interactions, admin and user login, cart operations, and search, including binary image storage, pagination, and data visualization with compass.
Visit the official download center to install MongoDB, selecting enterprise or community server (enterprise is free) and Windows. Download version 3.6.3 or latest and use Firefox if Chrome blocks.
Start the MongoDB server with mongod and connect using the mongo client on the default port 27017. If errors appear, create a data/db folder and restart to run show dbs.
Install Compass, a free GUI for MongoDB, to work with the server; download the stable release 1.12.5 from the official site, and use another browser if needed.
Install MongoDB Compass and connect to localhost via the graphical interface to explore the admin database and collections, preparing you to use Compass features to manage your PHP project.
Learn how to install composer from composer.org, set it up on Windows, and use it as a PHP dependency manager to download and update libraries.
Run composer to require the MongoDB library, generating vendor files and autoload files in the project root, then verify the installation before the next lecture.
Install the PHP driver by downloading the latest stable 64-bit thread-safe build from the official site, then copy the DLL to the PHP ext folder and restart Apache.
Copy the three resource files into the MongoDB PHP project's root, start the local server, and explore the index page with bootstrap links and dynamic book listings.
Explore building a PHP web app with MongoDB from scratch, wiring registration and login models, a hard-coded yet expandable navigation, Bootstrap and jQuery, and dynamic categories later.
Set up a hello world on the PHP web server, verify a MongoDB connection, and validate vendor autoload via Composer for local testing on localhost.
Build a mongodb database concept by creating three collections—users, books, and orders—storing documents in json/bson and practicing basic crud commands via a command line client.
Start the MongoDB server from the command line, create a test database with two collections, and insert a document to generate an object id.
Navigate MongoDB databases and collections, switch databases, and view documents using commands like getCollectionNames and find, while inserting single or multiple documents via a graphic user interface on localhost.
Learn to manage MongoDB databases, collections, and documents through the interface by creating and dropping databases and collections, editing and deleting documents, cloning documents, and refreshing the interface.
Switch from tables to document views, insert documents with compass, and verify updates in the mongo shell, seeing object ids and field values in a MongoDB collection.
Learn to use MongoDB's find with basic comparison operators—greater than, less than, and equals—to retrieve documents by field values and build simple or complex queries while understanding the query structure.
Explore the basics of projection in MongoDB. Learn to use find with a projection to fetch only desired fields from documents, including 1 or 0 to include or exclude fields.
Master update patterns in MongoDB with PHP by updating one or many documents using filters and $set operator. Practice finding targets and applying comparison operators like greater than or equal.
Demonstrate nested documents in a MongoDB collection by inserting a document with a nested field and an array using insert one, revealing an Object ID and the object structure.
Learn to operate with nested documents and arrays in MongoDB using dot notation, perform updates with filters, and verify changes with Compass while practicing with discompose.
Explore linking models, login and register flows, and admin access on the index page to set up a bookstore database and enable component inclusion.
Create a bookstore database and a users collection, then prepare for user registration by checking for existing users in the collection.
Create a users class and define a protected collection named users inside it to encapsulate data access, prevent external visibility, and make it ready for database interaction.
Connect to a MongoDB database with PHP by creating a class with a constructor that assigns a collection property, then instantiate and access the database bookstore and its users collection.
Switch to the MongoDB collection with a users class object by creating the user class and instantiating a users object through the server, database, and users collection connections.
Explore public and protected class modifiers with a practical PHP example, showing how public properties are accessible and modifiable from outside, while protected properties require a mediator method.
Create a reusable public method in the users class named check_input to sanitize user input by transforming characters, trimming whitespace, and stripping slashes for the registration form.
Insert a user record into MongoDB with PHP, using username, password, and email. Define a register function that creates a document in the bookstore users collection with an admin flag.
Learn how to insert a user with insert one in MongoDB using PHP, retrieve the last inserted id, and start a session to store it as the user id.
Learn to build a PHP MongoDB project by handling user registration and login with Bootstrap modals, posting form data to the index page and managing models.
Develop the register logic in php by building a form submission workflow, sanitizing inputs with a check_input function, using a users model, and preparing data for database insertion with checks.
Continue with our register logic part 2 by validating inputs, trimming whitespace, filtering harmful characters, checking for empty fields, and signaling errors before saving the user to the database.
Display a modal with JavaScript to show validation errors when a registration form has empty fields, using jQuery to show or hide the modal and echo scripts.
Demonstrates finishing the register flow by validating required fields, triggering conditional modals via JavaScript, and submitting data to the database, ensuring error handling and safe server operations.
Learn how to insert and verify user data in MongoDB with PHP, including a register function, input validation, and confirming the auto-generated object id with Compass.
Create a user data function that uses the session user ID to fetch the user's data with findOne, ensuring the ObjectId type is handled correctly.
Explain the object id concept in MongoDB, including auto-generated underscore id field, primary key roles in collections, and retrieving documents by object id in PHP.
Learn to search a MongoDB document by its _id using the ObjectID class in PHP, and why using the session's ObjectID ensures correct matches.
Learn to retrieve a full user document from MongoDB and access its fields as object properties in PHP, using a ternary operator to display the username safely.
Create a logout flow that destroys the session, unsets the session variable, and redirects to the index page; set up a logo function and prep a login page with admin checks.
Implement a login method that validates username and password against the users collection, starts a session on success, and emphasizes password encryption considerations.
Develop and integrate a login modal form in a PHP bootstrap project, including username and password fields, a post to the index page, and an admin checkbox.
Explain how PHP code handles a login form submitted via post, including an admin checkbox, username and password validation, and starting a session on success.
Continue the login logic by testing login, checking for empty fields, verifying the session is started and logout clears it, then discuss projection with MongoDB in PHP.
Learn how to apply projection in MongoDB to fetch only selected fields, such as admin, by querying a user document and excluding unnecessary fields to speed up performance.
Learn how to use find and cursors in MongoDB with PHP, iterate a cursor with foreach to access requested fields, and implement projections and pagination.
Learn how to apply limit and projection in a single MongoDB query, using a cursor to fetch and iterate documents while excluding certain fields like id and admin.
Update our login method uses projection to fetch only id and admin fields, sets session for user or admin based on credentials, and enables admin panel access and session-based navigation.
Set up for admin modal demonstrates conditionally displaying the admin username using session data and a ternary operator, and toggling admin versus regular user views through server checks.
Add admin functionality to the login flow by checking the admin checkbox, retrieving the id and admin field with a projection, and starting an admin session while avoiding code duplication.
Refine login logic by using a status variable for the admin checkbox, apply the ternary operator approach, and switch statements to replace repetition and enable easy future extensions.
Fix the modal appearance and tighten the login and registration flow to restrict regular users, relying on session checks and admin panel logic; verify login and registration work.
Learn how to automatically insert the server UTC date time as a timestamp into MongoDB, adding a created_at field to new users and querying by id.
Learn to store unix time in MongoDB using PHP, converting seconds since epoch to dates with time functions, and explore object id timestamps for creation times.
Enhance security in a php-mongodb project by hashing passwords, building an admin panel, and creating a books collection with image storage in mongodb.
Clean up the codebase by organizing logging, register, and admin models into dedicated folders, copying and creating controllers and forms to clarify data flow and maintenance.
Learn how to organize a php project by placing models under an include-based structure for easy review, and using include to submit pages to themselves.
Create a books class with a protected collection, implement a constructor to assign the collection, and add a search method to query the database for admin-provided values.
Learn to insert a new book in MongoDB by checking duplicates on title and category, then update the existing document or insert a new one with id projection.
Learn to insert a new book in the books collection with PHP by using findOne with title and category, project only the id, and update the document with form data.
Learn how to correctly construct a findOne projection in MongoDB with php, selecting fields like id and book title, filtering by category, and testing queries on the books collection.
Continue the logic for adding new books by inserting and updating book documents in the books collection, handling exceptions, and preparing binary data for image storage in MongoDB.
Learn to insert uploaded images into MongoDB by converting the image to binary with the Binary class using binary generic encoding, storing file contents, and later display as an image.
Learn how to use findOneAndUpdate in MongoDB to locate a document by ObjectId and apply updates with $set, while preserving created_at and updating updated_at.
Advance the insertion logic by validating the admin panel form for a new book, handling cover image uploads, and ensuring all fields are not empty before insertion.
Instantiate a new books class object with the books collection, validate non-empty fields, and call the new book function to insert data along with the uploaded cover image.
Create and access a books object in a PHP MongoDB project via the admin panel, handling binary image uploads and inserting or updating book records.
Recap: build a books class with collection books and a constructor, and add new_book to process form data and image uploads for admin inserts.
Insert around 10 books into the books collection via the admin panel, then use the location datatype to redirect back to the index page after insertion.
Learn how to verify inserted documents in MongoDB with Compass, filter by attributes, project fields like price, and update documents or add new fields in a PHP project.
Display left sidebar categories by querying MongoDB with a category projection, loop results, and output unique values while excluding _id; this lesson covers distinct queries.
Discover how to use MongoDB's distinct function to retrieve unique book categories by key and a query, and display one value per category on the PHP index page.
Create links for each category and tag them via the query string on the index page. Use category parameter in the get request to filter and display items by category.
Display books by category using a dynamic query that loads all books initially, filters by left sidebar categories, and adds pagination via a display method in the books class.
Build our display method in PHP by handling an optional category parameter; show all books when empty, or filter by category using MongoDB find, then iterate and echo book details.
Build a div-based book card display in a practical MongoDB with PHP project, including an image, title, category, description, and two action buttons floated left and right.
Develop the display method for the practical MongoDB with PHP project, illustrating category-based data retrieval, handling empty results, and using a ternary operator to render data.
Improve the display method by showing dynamic prices on buttons, using bootstrap classes, and rendering server-sourced titles and prices for a cleaner, prettier user interface.
Learn to display images stored as binary in MongoDB by encoding to base64, decoding to jpg, and rendering them in a PHP project.
Learn how base64 encodes binary data for text-based transfer and display, with practical examples in a PHP project tied to MongoDB.
Explore final settings for display method by applying inline styles, adjusting margin top, and managing box layout; observe how title truncation occurs and how hover reveals the full title.
Limit titles to 17 characters with ellipsis, using length checks and substring, then render five items per row and set up AJAX calls for details.
Explain implementing an autosearch feature in a PHP and MongoDB project, fetching live suggestions as you type and displaying matching books when selected.
Learn how to implement an HTML data list search box by binding input to a data list, showing options, and using a keyup Ajax call to fetch matches.
Create a jQuery driven search feature by wiring a keyup event on the input with id search bar, capturing its value, and performing an AJAX call to fetch results.
Log the search input to the browser console and observe value updates via dev tools. Prepare a post request to send the search value to a PHP script.
Make your first ajax post to the search beach endpoint, send data as post parameters, and log the received data to confirm the interaction.
Build an Ajax-driven search with PHP and MongoDB, sending post data to a books class and performing a like query to return results for live updates.
Discover how to use MongoDB regex in PHP to build flexible title searches, including case-insensitive matching, field projection, and patterns for starts with or contains.
Start building a PHP MongoDB search method using regex options to find book titles, perform case-insensitive matching, apply projection to return only titles, and iterate results for client delivery.
Learn how to use console.log to inspect Ajax search results in a PHP and JavaScript setup, extract titles from returned data, and dynamically populate search suggestions on the index page.
Split a semicolon-delimited string into a JavaScript array using the split function. Explore building the array from data and handling a trailing empty string to separate titles.
Master JavaScript array handling in a practical project by splitting values to form an array, removing the last element, and displaying titles as options under a search box.
Loop through an array in JavaScript with a foreach-like pattern. Create options with the title as value and display text, then append to the data list.
Append suggestions with datalist options in a practical MongoDB with PHP project, creating and inserting options, wiring a search with the id search books, and cleaning up previous results.
Clear the existing data list options on each keystroke, then append new suggestions from the ajax response. This enables live search behavior for the practical MongoDB with PHP project.
Finalize the ajax call to process user input, prevent leading whitespace from returning all titles, and render matching book titles in the datalist using a case-insensitive regex search.
Develop new skills in a practical manner, by doing a project together with me, using a in-demand database like Mongo. Actually, knowing both SQL (Relational Databases - MySQL, Sql Server, etc ) and No-SQL(Mongo, Redis, etc) is essential for every developer.
Learn working with Mongo Database, Compass visualizer of Mongo Database and PHP by building an OOP website starting from scratch and continuing up to a finished e-commerce website.
We will add functionalities like : Shopping Cart, CMS (Content Management System), Ajax Calls, Insert JPEG's into Database, Login Logic Database Calls, Database Connections, etc.
This course is mainly oriented on back-end side of things and less focused on looks and design that you can configure your own way.
I choose always the less complicated way of dealing with code when solving some issues because firstly this is a learning course and secondly, if you understand the basics of solving in one way, you'll be able to find better solutions as well. But always, basics first!
Even if is all about PHP OOP and Mongo DB, I am explaining every line of Javascript code as well. I don't like leaving things unexplained.
Also learn more about Ajax calls, Pagination, Creating a Cart System from scratch, OOP, Login and Register System.
Add an interesting website to your portfolio and learn how to insert and retrieve pictures directly in MongoDB, Find, Cursor, Projection, Push...and much more.