|
Book details / order |
PHP AND MONGODB WEB DEVELOPMENT BEGINNER’S GUIDE COMBINE THE POWER OF PHP AND MONGODB TO BUILD DYNAMIC WEB 2.0 APPLICATIONS |
What you will learn from this book
get mongodb up and running on the machine (windows/mac/linux)
build a php-powered website with mongodb as the data storage
handle http sessions with mongodb
store website analytics data in real time
process large datasets with mapreduce
use mongodb to supplement your existing relational database– build data archives, cache tiers, store results of expensive sql queries in mongodb
build location-aware web applications
optimize mongodb for better performance and security
in detail
with the rise of web 2.0, the need for a highly scalable database, capable of storing diverse user-generated content is increasing. mongodb, an open-source, non-relational database has stepped up to meet this demand and is being used in some of the most popular websites in the world. mongodb is one of the nosql databases which is gaining popularity for developing php web 2.0 applications.
php and mongodb web development beginner’s guide is a fast-paced, hands-on guide to get started with web application development using php and mongodb. the book follows a “code first, explain later” approach, using practical examples in php to demonstrate unique features of mongodb. it does not overwhelm you with information (or starve you of it), but gives you enough to get a solid practical grasp on the concepts.
the book starts by introducing the underlying concepts of mongodb. each chapter contains practical examples in php that teache specific features of the database.
the book teaches you to build a blogging application, handle user sessions and authentication, and perform aggregation with mapreduce. you will learn unique mongodb features and solve interesting problems like real-time analytics, location-aware web apps etc. you will be guided to use mongodb alongside mysql to build a diverse data back-end.
with its concise coverage of concepts and numerous practical examples, php and mongodb web development beginner’s guide is the right choice for the php developer to get started with learning mongodb.
approach
the book follows a “code first, explain later” approach, using practical examples in php to demonstrate unique features of mongodb. this book is packed with step-by-step instructions and practical examples, along with challenges to test and improve your knowledge.
who this book is for
this book assumes that you are experienced in web application development using php, html, and css. having working knowledge of using a relational database system such as mysql will help you grasp some of the concepts quicker, but it is not strictly mandatory. no prior knowledge of mongodb is required.
about the author
rubayeet islam is a software developer with over four years of experience in large-scale web application development on open-source technology stacks (lamp, python/django, ruby on rails). he is currently involved in developing cloud-based distributed software that uses mongodb as its analytics and metadata back-end. he has also spoken in seminars to promote the use of mongodb and nosql databases in general. he graduated from university of dhaka with bs in computer science and engineering.
preface
chapter 1: getting started with mongodb
the nosql movement
types of nosql databases
mongodb – a document-based nosql database
why mongodb?
who is using mongodb?
mongodb concepts—databases, collections, and documents
anatomy of document
bson—the data exchange format for mongodb
similarity with relational databases
downloading, installing, and running mongodb
system requirements
time for action – downloading and running mongodb on windows
installing the 64-bit version
time for action – downloading and running mongodb on linux
installing mongodb on os x
configuring mongodb
command-line parameters
file-based configuration
stopping mongodb
hitting control + c
from the mongo shell
sending int or term signal in unix
creating databases, collections, and documents
time for action – creating databases, collections, and documents
installing the php driver for mongodb
time for action – installing php driver for mongodb on windows
installing the php-mongodb driver on unix
connecting to the mongodb server from php
creating a php-mongo connection
time for action – creating a connection to the mongodb server from php
configuring the php-mongodb connection
specifying timeout for the connection attempt
summary
chapter 2: building your first mongodb powered web app
a mongodb powered blog
have the mongodb server running
inserting documents in mongodb
time for action – building the blog post creator
creating databases and collections implicitly
performing 'safe' inserts
benefits of safe inserts
specifying a timeout on insert
setting the user generated _id
the mongodate object
querying documents in a collection
time for action – retrieving articles from a database
the mongo query language
the mongocursor object
conditional queries
doing advanced queries in mongodb
time for action – building the blog dashboard
returning a subset of fields
sorting the query results
using count, skip, and limit
performing range queries on dates
updating documents in mongodb
time for action – building the blog editor
optional arguments to the update method
performing 'upsert'
using update versus using save
using modifier operations
setting with $set
incrementing with $inc
deleting fields with $unset
renaming fields with $rename
deleting documents in mongodb
time for action – deleting blog posts
optional arguments to remove
managing relationships between documents
embedded documents
referenced documents
time for action – posting comments to blog posts
embedded versus referenced – which one to use?
querying embedded objects
summary
chapter 3: building a session manager
understanding http sessions
understanding php native session handling
time for action – testing native php session handling
limitations of native php session handling
implementing session handling with mongodb
extending session handling with session_set_save_handler
the sessionmanager class
time for action – building the sessionmanager class
how the sessionmanager works
the constructor
the open and close methods
the read method
the write method
the destroy method
the gc method
putting the sessionmanager in action
time for action – putting sessionmanager into action
building the user authentication module
time for action – building the user class
creating the login, logout, and user profile page
time for action – creating the login, logout, and profile page
using good session practices
setting low expiry times of session cookies
using session timeouts
setting proper domains for session cookies
checking for browser consistency
summary
chapter 4: aggregation queries
generating sample data
time for action – generating sample data
understanding mapreduce
visualizing mapreduce
performing mapreduce in mongodb
time for action – counting the number of articles for each author
defining the map function
defining the reduce function
applying the map and reduce
viewing the results
performing mapreduce on a subset of the collection
concurrency
performing mongodb mapreduce within php
time for action – creating a tag cloud
performing aggregation using group()
time for action – calculating the average rating per author
grouping by custom keys
mapreduce versus group()
listing distinct values for a field
time for action – listing distinct categories of articles
using distinct() in mongo shell
counting documents with count()
summary
chapter 5: web analytics using mongodb
why mongodb is a good choice as a web analytics backend
logging with mongodb
time for action – logging page visits with mongodb
capped collections
sorting in natural order
updating and deleting documents in a capped collection
specifying the size of a regular collection
convert a regular collection to a capped one
extracting analytics data with mapreduce
time for action – finding total views and average response time per blog post
the map, reduce, and finalize functions
displaying the result
running mapreduce in real time versus running it in the background
real-time analytics using mongodb
time for action – building a real-time page visit counter
summary
chapter 6: using mongodb with relational databases
the motivation behind using mongodb and an rdbms together
potential use cases
defining the relational model
time for action – creating the database in mysql
caching aggregation results in mongodb
time for action – storing the daily sales history of products in mongodb
benefits of caching queries in mongodb
storing results of expensive joins
using mongodb for data archiving
time for action – archiving old sales records in mongodb
challenges in archiving and migration
dealing with foreign key constraints
preserving data types
storing metadata in mongodb
time for action – using mongodb to store customer metadata
problems with using mongodb and rdbms together
summary
chapter 7: handling large files with gridfs
what is gridfs?
the rationale of gridfs
the specification
advantages over the filesystem
storing files in gridfs
time for action – uploading images to gridfs
looking under the hood
serving files from gridfs
time for action – serving images from gridfs
updating metdata of a file
deleting files
reading files in chunks
time for action – reading images in chunks
when should you not use gridfs
summary
chapter 8: building location-aware web applications with mongodb and php
a geolocation primer
methods to determine location
detecting the location of a web page visitor
the w3c geolocation api
browsers that support geolocation
time for action – detecting location with w3c api
the geolocation object
the getcurrentposition() method
drawing the map using the google maps api
geospatial indexing
time for action – creating geospatial indexes
geospatial indexing – important things to know
performing location queries
time for action – finding restaurants near your location
the geonear() command
bounded queries
geospatial haystack indexing
time for action – finding nearby restaurants that serve burgers
summary
chapter 9: improving security and performance
enhancing query performance using indexes
time for action – creating an index on a mongodb collection
the _id index
unique indexes
compound keys indexes
indexing embedded document fields
indexing array fields
deleting indexes
when indexing cannot be used
indexing guidelines
choose the keys wisely
keep an eye on the index size
avoid using low-selectivity single key indexes
be aware of indexing costs
on a live database, run indexing in the background
optimizing queries
explaining queries using explain()
optimization rules
using hint()
profiling queries
understanding the output
optimization rules
securing mongodb
time for action – adding user authentication in mongodb
creating an admin user
creating regular user
viewing, changing, and deleting user accounts
user authentication through php driver
filtering user input
running mongodb server in a secure environment
ensuring data durability
journaling
performance
using fsync
replication
summary
chapter 10: easy mongodb administration with rockmongo and phpmoadmin
administering mongodb with rockmongo
time for action – installing rockmongo on your computer
exploring data with rockmongo
querying
updating, deleting, and creating documents
importing and exporting data
viewing stats
miscellaneous
using phpmoadmin to administer mongodb
time for action – installing phpmoadmin on your computer
viewing databases and collections
querying documents
saving and deleting objects
importing and exporting data
viewing stats
other features
rockmongo versus phpmoadmin
the verdict
summary
pop quiz answers
chapter 1, getting started with mongodb
chapter 2, building your first mongodb powered web app
chapter 3, building a session manager
chapter 4, aggregation queries
chapter 5, web analytics using mongodb
chapter 7, handling large files with gridfs
chapter 8, building location-aware web applications with mongodb and php
chapter 9, improving security and performance
index.
Author : Rubayeet islam
Publication : Packt publication
Isbn : 9789351105572
Store book number : 105
NRS 960.00
|
|
|
|
|
|
|
|
|
|