1
0
mirror of https://github.com/restoreddev/phpapprentice.git synced 2025-08-13 10:15:07 +02:00

Converted chapters to markdown and changed pages to vertical layout

This commit is contained in:
Andrew Davis
2019-01-02 20:12:35 -06:00
parent 0c17549268
commit cbd3c539bb
56 changed files with 1305 additions and 1060 deletions

View File

@@ -13,8 +13,8 @@ body {
padding-bottom: 1em;
}
pre, code {
font-family: Consolas, monaco, monospace;
font-size: 16px;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 14px;
margin: 0 !important;
border-radius: 0 !important;
padding-top: 0.5em !important;
@@ -32,10 +32,12 @@ hr {
border: 0;
height: 1px;
background-color: #EEE;
margin: 0.5em 0;
}
p {
max-width: 40em;
line-height: 1.5;
margin-top: 1.5em;
margin-bottom: 0.75em;
}
ol {
padding-left: 1em;
@@ -99,9 +101,10 @@ button:hover .icon svg {
clear: both;
}
.container {
width: 1050px;
margin-left: auto;
margin-right: auto;
max-width: 1050px;
}
.container.small {
max-width: 750px;
}
.center {
margin-left: auto;
@@ -159,8 +162,8 @@ button:hover .icon svg {
.navigate-links a:hover {
text-decoration: none;
}
.table-of-contents {
padding: 2em;
.table-of-contents h4 {
margin-top: 0;
}
.table-of-contents ol {
margin: 1em 0;
@@ -174,22 +177,21 @@ button:hover .icon svg {
width: 1em;
display: inline-block;
}
.home-title-wrapper {
display: grid;
grid-template-columns: 175px 1fr;
grid-template-rows: 1fr 1fr;
}
.home-title {
text-align: center;
}
.home-subtitle {
text-align: center;
margin-top: 0;
grid-column-start: 2;
grid-column-end: 3;
}
.home-logo {
grid-row-start: 1;
grid-row-end: 3;
display: block;
margin: 0 auto;
width: 150px;
height: 100px;
margin-bottom: 0.5em;
}
.home-logo svg {
width: 150px;
@@ -221,6 +223,9 @@ button:hover .icon svg {
box-shadow: 0 0 10px 0 $drop-shadow;
box-sizing: border-box;
}
.modal-content .table-of-contents {
padding: 2em;
}
.closed {
display: none;
}

View File

@@ -6,6 +6,7 @@
<title><?= $title ?? 'PHP Apprentice' ?></title>
<meta name="description" content="<?= $subtitle ?? 'A site for learning how to use PHP' ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php echo asset('css/site.css') ?>">
<link rel="icon" href="/favicon-32.png">

View File

@@ -1,40 +1,51 @@
<?php partial('header', ['title' => 'PHP Apprentice - Credits']) ?>
<div class="container center">
<div class="grid-toc">
<div>
<h1>Credits</h1>
<p>
PHP Apprentice was inspired by
<a href="https://gobyexample.com/">Go By Example</a> and by <a href="https://elixirschool.com/">Elixir School</a>. Both sites offer excellent, quality documentation in Go and Elixir and I want PHP Apprentice to provide the same
experience for the PHP programming language.
</p>
<p>
Sites used as a reference while writing PHP Apprentice:
<ul>
<li><a href="https://secure.php.net/" target="_blank">php.net</a></li>
<li><a href="https://www.phptherightway.com/" target="_blank">PHP The Right Way</a></li>
</ul>
</p>
<p>
PHP Apprentice was built using several open source projects, besides PHP itself.
Thank you to each of these maintainers for providing great libraries!
<ul>
<li><a href="https://prismjs.com/" target="_blank">Prism.js</a></li>
<li><a href="https://www.zondicons.com/" target="_blank">Zondicons by Steve Schoger</a></li>
<li><a href="https://postcss.org/" target="_blank">PostCSS</a></li>
<li><a href="https://symfony.com/doc/current/components/console.html" target="_blank">Symfony CLI</a></li>
<li><a href="https://symfony.com/doc/current/frontend.html" target="_blank">Symfony Encore</a></li>
</ul>
</p>
<hr />
<p>
phpapprentice.com was created and is managed by <a href="https://twitter.com/restoreddev">Andrew Davis</a>.
</p>
</div>
<div>
<?php partial('table_of_contents') ?>
</div>
<div class="container small center">
<div class="menu">
<button class="menu-button" title="Open Menu">
<div class="icon"><?= icon('menu') ?></div>
Menu
</button>
</div>
<div>
<h1>Credits</h1>
<p>
PHP Apprentice was inspired by
<a href="https://gobyexample.com/">Go By Example</a> and by <a href="https://elixirschool.com/">Elixir School</a>. Both sites offer excellent, quality documentation in Go and Elixir and I want PHP Apprentice to provide the same
experience for the PHP programming language.
</p>
<p>
Sites used as a reference while writing PHP Apprentice:
<ul>
<li><a href="https://secure.php.net/" target="_blank">php.net</a></li>
<li><a href="https://www.phptherightway.com/" target="_blank">PHP The Right Way</a></li>
</ul>
</p>
<p>
PHP Apprentice was built using several open source projects, besides PHP itself.
Thank you to each of these maintainers for providing great libraries!
<ul>
<li><a href="https://prismjs.com/" target="_blank">Prism.js</a></li>
<li><a href="https://www.zondicons.com/" target="_blank">Zondicons by Steve Schoger</a></li>
<li><a href="https://postcss.org/" target="_blank">PostCSS</a></li>
<li><a href="https://symfony.com/doc/current/components/console.html" target="_blank">Symfony CLI</a></li>
<li><a href="https://symfony.com/doc/current/frontend.html" target="_blank">Symfony Encore</a></li>
</ul>
</p>
<hr />
<p>
phpapprentice.com was created and is managed by <a href="https://twitter.com/restoreddev">Andrew Davis</a>.
</p>
</div>
</div>
<div class="modal closed">
<div class="modal-content">
<button class="modal-button right" title="Close">
<div class="icon"><?= icon('close-outline') ?></div>
</button>
<?php partial('table_of_contents') ?>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<?php partial('header', ['title' => $title, 'subtitle' => $subtitle]) ?>
<div class="container center">
<div class="container small center">
<div class="menu">
<button class="menu-button" title="Open Menu">
<div class="icon"><?= icon('menu') ?></div>
@@ -10,7 +10,7 @@
<h1><?= escape($title) ?></h1>
<h3 class="subtitle"><?= escape($subtitle) ?></h3>
<?= code_table($code) ?>
<?= $chapter ?>
<div class="clearfix"></div>
<div class="navigate-links">

View File

@@ -1,35 +1,45 @@
<?php partial('header', ['title' => 'PHP Apprentice']) ?>
<div class="container center">
<div class="grid-toc">
<div>
<div class="home-title-wrapper">
<div class="home-logo"><?= icon('elephant') ?></div>
<h1 class="home-title">PHP Apprentice</h1>
<h3 class="home-subtitle">A site for learning how to use PHP</h3>
</div>
<p>
The goal of PHP Apprentice is to be an easy to understand resource for learning how to write good code in the PHP programming language. There are a lot of PHP tutorials on the internet that use outdated libraries, insecure programming practices or inefficient code. I want this site to show how to write PHP code with quality.
</p>
<p>
The site currently has content for learning the basics of PHP. In the future, more pages will be added for more advanced topics like building websites, database integration and security.
</p>
<p>
PHP Apprentice is currently a work in progress. If you would like to contribute or request a certain discussion topic, check out the <a href="https://github.com/restoreddev/phpapprentice" target="_blank">GitHub repository</a>.
</p>
<p>
To get started, you will need to <a href="<?php echo page_path('installing-php') ?>">install</a> PHP, have a text editor and open your terminal.
Each example in PHP Apprentice can by typed into a PHP file and executed in the terminal.
Let's get started! 😃
</p>
<a href="<?= page_path('basics') ?>" class="button">
<div class="icon"><?= icon('book-reference') ?></div>
Open First Chapter
</a>
</div>
<div>
<?php partial('table_of_contents') ?>
<div class="container small center">
<div class="menu">
<button class="menu-button" title="Open Menu">
<div class="icon"><?= icon('menu') ?></div>
Menu
</button>
</div>
<div>
<div class="home-title-wrapper">
<div class="home-logo"><?= icon('elephant') ?></div>
<h1 class="home-title">PHP Apprentice</h1>
<h3 class="home-subtitle">A site for learning how to use PHP</h3>
</div>
<p>
The goal of PHP Apprentice is to be an easy to understand resource for learning how to write good code in the PHP programming language. There are a lot of PHP tutorials on the internet that use outdated libraries, insecure programming practices or inefficient code. I want this site to show how to write PHP code with quality.
</p>
<p>
The site currently has content for learning the basics of PHP. In the future, more pages will be added for more advanced topics like building websites, database integration and security.
</p>
<p>
PHP Apprentice is currently a work in progress. If you would like to contribute or request a certain discussion topic, check out the <a href="https://github.com/restoreddev/phpapprentice" target="_blank">GitHub repository</a>.
</p>
<p>
To get started, you will need to <a href="<?php echo page_path('installing-php') ?>">install</a> PHP, have a text editor and open your terminal.
Each example in PHP Apprentice can by typed into a PHP file and executed in the terminal.
Let's get started! 😃
</p>
<a href="<?= page_path('basics') ?>" class="button">
<div class="icon"><?= icon('book-reference') ?></div>
Open First Chapter
</a>
</div>
</div>
<div class="modal closed">
<div class="modal-content">
<button class="modal-button right" title="Close">
<div class="icon"><?= icon('close-outline') ?></div>
</button>
<?php partial('table_of_contents') ?>
</div>
</div>

View File

@@ -1,30 +1,41 @@
<?php partial('header', ['title' => 'PHP Apprentice - Installing PHP']) ?>
<div class="container center">
<div class="grid-toc">
<div>
<h1>Installing PHP</h1>
<h2>Windows 10</h2>
<ol class="body-ol">
<li>Download PHP from the <a href="https://windows.php.net/download">PHP For Windows</a> site. I recommend downloading the non-thread safe PHP 7.1 or 7.2 (unless you want to use Apache and you know if you do). You will also need to choose 32 bit (x86) or 64 bit (x64) depending on your version of Windows.</li>
<li>Download the corresponding Visual C++ Redistributable from the same site. For PHP 7.1, it is VC14 and for PHP 7.2, it is VC15.</li>
<li>Install the VC redistrubutable using the downloaded executable.</li>
<li>The PHP download comes in a zip folder. Extract the zip folder into your user directory in a folder named "php". The path should look like "C:\Users\username\php".</li>
<li>Next, we need to add PHP to your environment variables path. Open "System" under "Control Panel". Go to the "Advanced" tab and select "Environment Variables". In the "User variables" section, select "Path" and click the "Edit" button. You will see a list of different folder paths. Add the PHP path to the list using the "Add" button. The PHP path is the same folder where you extracted PHP.</li>
<li>Now, you can open PowerShell or Command Prompt and type "php -v" to verify PHP was installed correctly. It will return the installed version of PHP on your system.</li>
</ol>
<div class="container small center">
<div class="menu">
<button class="menu-button" title="Open Menu">
<div class="icon"><?= icon('menu') ?></div>
Menu
</button>
</div>
<h2>MacOS</h2>
<p>Good news! Each version of MacOS comes with PHP by default. However, if you are running an older version of MacOS or OS X, then you will need to manually install a new version of PHP. To check your current version, open Terminal and type "php -v". You will need at least PHP 7.1 on your computer to use all the features in these tutorials.</p>
<ol class="body-ol">
<li>Install <a href="https://brew.sh/">Homebrew</a>.</li>
<li>Run "brew install php" in Terminal.</li>
<li>Check your version is correct by running "php -v" in Terminal.</li>
</ol>
</div>
<div>
<?php partial('table_of_contents') ?>
</div>
<div>
<h1>Installing PHP</h1>
<h2>Windows 10</h2>
<ol class="body-ol">
<li>Download PHP from the <a href="https://windows.php.net/download">PHP For Windows</a> site. I recommend downloading the non-thread safe PHP 7.1 or 7.2 (unless you want to use Apache and you know if you do). You will also need to choose 32 bit (x86) or 64 bit (x64) depending on your version of Windows.</li>
<li>Download the corresponding Visual C++ Redistributable from the same site. For PHP 7.1, it is VC14 and for PHP 7.2, it is VC15.</li>
<li>Install the VC redistrubutable using the downloaded executable.</li>
<li>The PHP download comes in a zip folder. Extract the zip folder into your user directory in a folder named "php". The path should look like "C:\Users\username\php".</li>
<li>Next, we need to add PHP to your environment variables path. Open "System" under "Control Panel". Go to the "Advanced" tab and select "Environment Variables". In the "User variables" section, select "Path" and click the "Edit" button. You will see a list of different folder paths. Add the PHP path to the list using the "Add" button. The PHP path is the same folder where you extracted PHP.</li>
<li>Now, you can open PowerShell or Command Prompt and type "php -v" to verify PHP was installed correctly. It will return the installed version of PHP on your system.</li>
</ol>
<h2>MacOS</h2>
<p>Good news! Each version of MacOS comes with PHP by default. However, if you are running an older version of MacOS or OS X, then you will need to manually install a new version of PHP. To check your current version, open Terminal and type "php -v". You will need at least PHP 7.1 on your computer to use all the features in these tutorials.</p>
<ol class="body-ol">
<li>Install <a href="https://brew.sh/">Homebrew</a>.</li>
<li>Run "brew install php" in Terminal.</li>
<li>Check your version is correct by running "php -v" in Terminal.</li>
</ol>
</div>
</div>
<div class="modal closed">
<div class="modal-content">
<button class="modal-button right" title="Close">
<div class="icon"><?= icon('close-outline') ?></div>
</button>
<?php partial('table_of_contents') ?>
</div>
</div>