Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering PHP Design Patterns

You're reading from   Mastering PHP Design Patterns Develop robust and reusable code using a multitude of design patterns for PHP 7

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781785887130
Length 270 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Junade Ali Junade Ali
Author Profile Icon Junade Ali
Junade Ali
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Why "Good PHP Developer" Isnt an Oxymoron 2. Anti-Patterns FREE CHAPTER 3. Creational Design Patterns 4. Structural Design Patterns 5. Behavioral Design Patterns 6. Architectural Patterns 7. Refactoring 8. How to Write Better Code

Environment variables in PHP source

Far too often you come across a project on GitHub and you notice that the original developer has left in a config.php file that contains (in the best case) useless database information or (in the worst case) incredibly important API keys.

When these files aren't accidentally versioned they are often shoved in a .gitignore file with a sample file attached for developers to amend as they need. One example of a platform that does this is WordPress.

There are some minor improvements to this, such as putting core configuration in an XML file that is buried in some obscure document with plenty of irrelevant configuration.

I've found that there tend to be two good ways of managing environment variables in PHP. The first method involves putting them in a file on your root folder in a format such as YML and reading these variables as required.

The second way, which I personally prefer, is a method implemented by a library known as dotenv. Essentially, what...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Mastering PHP Design Patterns
You have been reading a chapter from
Mastering PHP Design Patterns
Published in: Sep 2016
Publisher: Packt
ISBN-13: 9781785887130
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime
Modal Close icon
Modal Close icon