<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
</head>
<body style="-ms-text-size-adjust: 100%; -webkit-text-size-adjust:
100%; margin: 0; padding: 0; width: 100% !important"
bgcolor="#FFFFFF" text="#000000">
<style type="text/css">
body {
width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;
}
.ExternalClass {
width: 100%;
}
.ExternalClass {
line-height: 100%;
}
#backgroundTable {
margin: 0; padding: 0; width: 600px !important; line-height: 100% !important;
}
img {
outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;
}
h1 a:active {
color: red !important;
}
h2 a:active {
color: red !important;
}
h3 a:active {
color: red !important;
}
h4 a:active {
color: red !important;
}
h5 a:active {
color: red !important;
}
h6 a:active {
color: red !important;
}
h1 a:visited {
color: purple !important;
}
h2 a:visited {
color: purple !important;
}
h3 a:visited {
color: purple !important;
}
h4 a:visited {
color: purple !important;
}
h5 a:visited {
color: purple !important;
}
h6 a:visited {
color: purple !important;
}
</style>
<div id="main-content" style="color: #222222; font-family:
'Helvetica', 'Arial', sans-serif; font-size: 14px; line-height:
1.4; padding: 25px; width: 550px">Dear List-members, here is also
some idea ...<br>
------------------<br>
Today we're going to dive into <strong style="font-weight: bold"><span
style="line-height: 1.6">Modernizing your codebase</span></strong><span
style="line-height: 1.6">.</span>
<div>
<h2 style="color: black !important; font-size: 16px;
font-weight: bold; margin: 0 0 12px; padding: 0">Coding
Standard</h2>
<p style="margin: 1em 0">For years, there were no uniformed
standards for writing PHP code. Some of us chose to follow
Zend Framework Coding Standard, some preferred PEAR Coding
Standard, and the rest simply came out their own way of
writing PHP code.</p>
<p style="margin: 1em 0">Distributing PHP code without a coding
standard is kind of mess. Since everyone has his or her own
way of formatting the source code, scanning someone else's
code becomes a hassle. By sticking to one uniformed coding
standard, we not only encourage someone else to read our code,
but also make reading someone else's code easier for
ourselves.</p>
<p style="margin: 1em 0">So first step to become a modern PHP
developer is to adopt a coding standard. Currently the most
updated coding standard in PHP is PSR-2 (PHP Standards
Recommendations number 2).</p>
<h2 style="color: black !important; font-size: 16px;
font-weight: bold; margin: 0 0 12px; padding: 0">Autoloading</h2>
<p style="margin: 1em 0">Are you tired of using statements like <code>include
/ require </code>whenever you need to include classes from
other files.</p>
<p style="margin: 1em 0">We had this problem in PHP for a long
time. Code became cluttered and ugly when we used this
technique in our main file to include all desired classes. Not
only that, it was difficult to maintain the codebase, for
example when some classes needed to be refactored to other
names.</p>
<p style="margin: 1em 0">Fortunately we have autoloader.
Basically, autoloader is a technique to load classes from file
paths automatically. This magic saves us from hard coding file
paths whenever we need those classes.</p>
<p style="margin: 1em 0">So if you are writing a class or using
someone else's class today, start using PSR-4 Autoloader,
which is the latest autoloading specification.</p>
<h2 style="color: black !important; font-size: 16px;
font-weight: bold; margin: 0 0 12px; padding: 0">Package
management</h2>
<p style="margin: 1em 0">In the old days, managing 3rd party
libraries in your own codebase was super difficult. The
following was a typical scenario: you downloaded an awesome
library from the Internet and it worked great with your
existing codebase. You were happy until you needed to upgrade
the library because the server had upgraded its PHP version.
The codebase started breaking down right after you downloaded
the latest version of the library. You had no clue why it
happened. You had not changed any piece of your code. So you
asked your server admin and consulted your fellow colleagues.
After half a day of digging through code, you found that one
of the API methods was removed from the latest version of the
"awesome" library you downloaded.</p>
<p style="margin: 1em 0">Does above story sound familiar to you?</p>
<p style="margin: 1em 0">Fortunately we have Composer. The
de-factor package manager for PHP codebase. It takes care of
all the nitty-gritty of using a package for us.</p>
<p style="margin: 1em 0">So if you have not yet started with
Composer, start using it right now!</p>
</div>
<div>Next up, we'll learn about <strong style="font-weight: bold"><span
style="line-height: 1.6">Modernizing your database handling</span></strong>.</div>
<div> </div>
<div> </div>
<div>Until tomorrow,</div>
<div>
<br>
Keep learning!<br>
Xu<br>
<a class="moz-txt-link-abbreviated" href="http://www.startutorial.com">www.startutorial.com</a></div>
</div>
<div id="footer" style="border-top-color: #d0d0d0; border-top-style:
solid; border-top-width: 1px; color: #777; font-family:
'Helvetica', 'Arial', sans-serif; font-size: 13px; line-height:
1.4; padding: 25px; width: 550px">Kindest regards:<br>
Istvan Holbok<br>
</div>
<img src="cid:part1.18346BD8.68B13339@gmail.com" alt=""
style="height:1px !important;width:1px !important;border-width:0
!important;margin-top:0 !important;margin-bottom:0
!important;margin-right:0 !important;margin-left:0
!important;padding-top:0 !important;padding-bottom:0
!important;padding-right:0 !important;padding-left:0 !important;"
height="1" border="0" width="1">
</body>
</html>