update slides before PHP Stoke
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/**/*.pdf
|
4
archive/upgrading-to-drupal-9/README.rst
Normal file
|
@ -0,0 +1,4 @@
|
|||
Upgrading to Drupal 9
|
||||
#####################
|
||||
|
||||
https://www.oliverdavies.uk/talks/upgrading-your-site-drupal-9
|
BIN
archive/upgrading-to-drupal-9/images/10-years-tweet.png
Normal file
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 152 KiB |
BIN
archive/upgrading-to-drupal-9/images/broadbean-drupal-flow-2.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
archive/upgrading-to-drupal-9/images/broadbean-website.png
Normal file
After Width: | Height: | Size: 4.2 MiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-repo.png
Normal file
After Width: | Height: | Size: 192 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/1.png
Normal file
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 137 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/2.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/3.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/4.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/5.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/6.png
Normal file
After Width: | Height: | Size: 107 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/7.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/8.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
archive/upgrading-to-drupal-9/images/dransible-screenshots/9.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
archive/upgrading-to-drupal-9/images/drupal-association.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
archive/upgrading-to-drupal-9/images/drupal-check-output.png
Normal file
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 102 KiB |
BIN
archive/upgrading-to-drupal-9/images/matt-stauffer-tweet.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
archive/upgrading-to-drupal-9/images/multiple-versions.png
Normal file
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 78 KiB |
BIN
archive/upgrading-to-drupal-9/images/phpunit-deprecation.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
archive/upgrading-to-drupal-9/images/semver.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
archive/upgrading-to-drupal-9/images/timmillwood-ono.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
archive/upgrading-to-drupal-9/images/title.png
Normal file
After Width: | Height: | Size: 129 KiB |
|
@ -13,7 +13,6 @@ pageSetup:
|
|||
|
||||
pageTemplates:
|
||||
coverPage:
|
||||
# background: images/title.png
|
||||
frames: []
|
||||
[12%, 10%, 76%, 75%]
|
||||
showFooter: false
|
||||
|
@ -22,13 +21,13 @@ pageTemplates:
|
|||
titlePage:
|
||||
alignment: TA_CENTER
|
||||
frames: []
|
||||
[8%, 8%, 85%, 65%]
|
||||
[8%, 8%, 85%, 60%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
|
||||
standardPage:
|
||||
frames: []
|
||||
[3%, 3%, 92%, 92%]
|
||||
[3%, 3%, 94%, 92%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
|
||||
|
@ -38,37 +37,34 @@ pageTemplates:
|
|||
[12%, 10%, 76%, 80%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
|
||||
outputPage:
|
||||
frames: []
|
||||
[8%, 10%, 82%, 65%]
|
||||
showFooter: false
|
||||
showHeader: false
|
||||
|
||||
|
||||
linkColor: #24608a
|
||||
|
||||
fontsAlias:
|
||||
stdMono: Inconsolata-Regular
|
||||
stdMonoBold: Inconsolata-Regular
|
||||
stdMonoBoldItalic: Inconsolata-Regular
|
||||
stdMonoItalic: Inconsolata-Regular
|
||||
|
||||
styles:
|
||||
normal:
|
||||
fontSize: 24
|
||||
leading: 32
|
||||
fontSize: 28
|
||||
textColor: #383745
|
||||
|
||||
bodytext:
|
||||
alignment: TA_LEFT
|
||||
|
||||
heading:
|
||||
fontSize: 20
|
||||
alignment: TA_CENTER
|
||||
fontSize: 24
|
||||
spaceAfter: 16
|
||||
textColor: #24608a
|
||||
|
||||
heading1:
|
||||
parent: heading
|
||||
alignment: TA_LEFT
|
||||
|
||||
title:
|
||||
fontSize: 300%
|
||||
fontSize: 250%
|
||||
parent: heading
|
||||
|
||||
bullet-list:
|
||||
|
@ -85,13 +81,13 @@ styles:
|
|||
|
||||
titleslideinfo:
|
||||
alignment: TA_CENTER
|
||||
fontSize: 140%
|
||||
fontSize: 120%
|
||||
parent: normal
|
||||
|
||||
footer:
|
||||
alignment: TA_RIGHT
|
||||
fontName: stdMono
|
||||
fontSize: 20
|
||||
fontSize: 18
|
||||
textColor: #24608a
|
||||
rightIndent: 16
|
||||
spaceBefore: 0
|
||||
|
@ -103,23 +99,20 @@ styles:
|
|||
code:
|
||||
backColor: white
|
||||
borderWidth: 0
|
||||
fontSize: 20
|
||||
leading: 24
|
||||
fontSize: 24
|
||||
parent: literal
|
||||
spaceBefore: 4
|
||||
|
||||
blockquote:
|
||||
parent: normal
|
||||
fontName: stdItalic
|
||||
leading: 36
|
||||
|
||||
attribution:
|
||||
parent: normal
|
||||
textColor: #66666
|
||||
textColor: #666666
|
||||
|
||||
centred:
|
||||
alignment: TA_CENTER
|
||||
parent: normal
|
||||
smaller:
|
||||
textColor: red
|
||||
|
||||
centredtitle:
|
||||
alignment: TA_CENTER
|
||||
|
@ -127,3 +120,7 @@ styles:
|
|||
fontSize: 48
|
||||
leading: 64
|
||||
parent: heading
|
||||
|
||||
centred:
|
||||
alignment: TA_CENTER
|
||||
parent: normal
|
488
archive/upgrading-to-drupal-9/slides.rst
Normal file
|
@ -0,0 +1,488 @@
|
|||
.. footer:: @opdavies
|
||||
|
||||
Upgrading to Drupal 9
|
||||
#####################
|
||||
|
||||
|
|
||||
|
||||
.. class:: titleslideinfo
|
||||
|
||||
Oliver Davies, Inviqa
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/10-years-tweet.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Recently, I passed 10 years working full-time with Drupal and PHP (I'd been working with it for a few years prior to this too)."
|
||||
TextAnnotation "Worked with Drupal 6, 7, 8 and 9."
|
||||
TextAnnotation "Worked on a number of D6 to D7, and D8 to D9 upgrades"
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
The D7 release cycle
|
||||
====================
|
||||
|
||||
* One long-running branch
|
||||
* Minor versions for bug fixes (7.80, April 2021)
|
||||
* No big, new features
|
||||
* Long time for changes to get committed to core
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Before we get into the D9 stuff."
|
||||
TextAnnotation "D7 and earlier..."
|
||||
|
||||
The D8 release cycle
|
||||
====================
|
||||
|
||||
* Semantic versioning for core
|
||||
* Minor release (new features) every 6 months
|
||||
* Patch release (bug fixes) every month
|
||||
* Multiple supported versions of core (8.9, 9.0, 9.1)
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Drupal 8 onwards..."
|
||||
TextAnnotation "Minor release = new functionality"
|
||||
TextAnnotation "Patch release = bug fixes"
|
||||
TextAnnotation "Change from 'it will be ready when it's ready' (D7) to a fixed release cycle and schedule, and what makes it in time will be added."
|
||||
TextAnnotation "8.9 is an LTS release"
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/2019_minor_release_schedule.png
|
||||
:width: 20cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Drupal 8 vs Drupal 9
|
||||
====================
|
||||
|
||||
* No new functionality
|
||||
* Deprecated code removed
|
||||
* PHP required version increased
|
||||
* Major versions of dependencies updated
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Different to previous major version updates"
|
||||
TextAnnotation "Symfony upgraded from 3 to 4."
|
||||
|
||||
Previous upgrade issues
|
||||
=======================
|
||||
|
||||
* Lots of breaking changes
|
||||
* Core released, but contrib takes time to catch up
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Lots of breaking changes, large rebuilds and migrations"
|
||||
TextAnnotation "6(?) months between D7 core and Views being released, prevents adoption"
|
||||
TextAnnotation "Jeff Geerling blog post 'Did breaking backwards compatibility kill Drupal?'"
|
||||
|
||||
Contrib improvements
|
||||
====================
|
||||
|
||||
* Minimal code changes required
|
||||
* Single release can support multiple versions of core
|
||||
* Semantic versioning enabled for contrib projects
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Need to fix deprecation notices, and replace deprecated code with the suggested replacements"
|
||||
TextAnnotation "Modules, themes and distributions can now work with multiple versions of Drupal core in the same release"
|
||||
TextAnnotation "`core` key replaced with `core_version_requirement`"
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/multiple-versions.png
|
||||
:width: 20cm
|
||||
|
||||
|
|
||||
|
||||
.. image:: images/semver.png
|
||||
:width: 20cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
The difference is deprecated code
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Code that has been replaced by newer code and marked to be removed."
|
||||
TextAnnotation "Not removed immediately to keep backwards compatibility."
|
||||
TextAnnotation "A backwards compatibility break would require a major version change rather than a minor one."
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Deprecation example
|
||||
===================
|
||||
|
||||
.. code-block:: php
|
||||
:startinline: true
|
||||
|
||||
function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE) {
|
||||
@trigger_error('drupal_set_message() is deprecated in Drupal 8.5.0 and will
|
||||
be removed before Drupal 9.0.0. Use \Drupal\Core\Messenger\MessengerInterface
|
||||
::addMessage() instead. See https://www.drupal.org/node/2774931',
|
||||
E_USER_DEPRECATED);
|
||||
|
||||
$messenger = \Drupal::messenger();
|
||||
if (isset($message)) {
|
||||
$messenger->addMessage($message, $type, $repeat);
|
||||
}
|
||||
return $messenger->all();
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "drupal_set_message has been replaced by a Messenger service, this should be used instead."
|
||||
TextAnnotation "Works but triggers an error in 8.9, breaks in 9.0."
|
||||
TextAnnotation "To ensure D9 compatibility, update all of the deprecated code."
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
How do I find it?
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Drupal Check
|
||||
============
|
||||
|
||||
- Developed by Matt Glaman
|
||||
- "Built on PHPStan, this static analysis tool will check for correctness (e.g. using a class that doesn't exist), deprecation errors, and more."
|
||||
- https://github.com/mglaman/drupal-check
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer global require
|
||||
mglaman/drupal-check``
|
||||
|
||||
.. page::
|
||||
.. class:: centredtitle
|
||||
|
||||
``drupal-check web/modules/custom``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/drupal-check-output.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
Upgrade Status module
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/drupal-check-upgrade-status-comparison.png
|
||||
:width: 12cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
PHPUnit Bridge
|
||||
==============
|
||||
|
||||
- Drupal 8 uses Symfony's PHPUnit Bridge
|
||||
- Includes a 'Deprecation Helper'
|
||||
- Displays deprecation notices in test output
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/phpunit-deprecation.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Fixing deprecations
|
||||
===================
|
||||
|
||||
.. code-block:: diff
|
||||
|
||||
- drupal_set_message($text);
|
||||
+ Drupal::messenger()->addMessage($text);
|
||||
|
||||
.. image:: images/logo-composer-transparent.png
|
||||
:width: 10cm
|
||||
|
||||
Composer
|
||||
========
|
||||
|
||||
- Dependency management tool for PHP
|
||||
- My preferred way to manage Drupal codebases
|
||||
- composer.json lists your dependencies and version constraints
|
||||
- composer.lock stores the installed dependencies and versions
|
||||
- Separate packages for ``core-recommended``, ``core-dev`` and ``core-composer-scaffold``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Used by the majority of PHP frameworks and projects (Symfony, Laravel, Drush, Drupal Console)."
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer require
|
||||
drupal/admin_toolbar:^2.0``
|
||||
|
||||
.. page::
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer install``
|
||||
|
||||
.. page::
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer update
|
||||
drupal/admin_toolbar``
|
||||
|
||||
.. page::
|
||||
.. class:: centredtitle
|
||||
|
||||
Always add '--no-dev' in production
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Prevents development dependencies from being installed, and potential security exploits from being added."
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
An Example: Dransible
|
||||
|
||||
.. class:: centred
|
||||
|
||||
https://github.com/opdavies/dransible
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/dransible-repo.png
|
||||
:width: 20cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Upgrading Dransible
|
||||
===================
|
||||
|
||||
- Remove Drush (temporarily)
|
||||
- Update from Drupal 8.8 to 8.9
|
||||
- Add Upgrade Status module
|
||||
- Update contrib modules to D9 compatible versions
|
||||
- Remove incompatible contrib modules (if possible)
|
||||
- Fix deprecations in custom code
|
||||
- Upgrade from Drupal 8.9 to 9.0
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Without removing Drush, 8.9.0-beta2 rather than 8.9.2"
|
||||
TextAnnotation "Updated Admin Toolbar module to a D9 compatible version"
|
||||
TextAnnotation "Removed Config Installer as no longer needed"
|
||||
TextAnnotation "Fixed deprecation warnings in custom code"
|
||||
TextAnnotation "Installed Drush 10, removed and uninstalled Upgrade Status module"
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer update drupal/core-*
|
||||
--with-dependencies``
|
||||
|
||||
.. page::
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer require
|
||||
drupal/upgrade_status``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/dransible-screenshots/1.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/dransible-screenshots/2.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/dransible-screenshots/3.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/dransible-screenshots/4.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/dransible-screenshots/5.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/dransible-screenshots/6.png
|
||||
:width: 20cm
|
||||
|
||||
.. image:: images/dransible-screenshots/7.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/dransible-screenshots/8.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer update drupal/core-*
|
||||
--with-dependencies``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/dransible-screenshots/9.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/dransible-screenshots/10.png
|
||||
:width: 20cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Only 6 files changed rather than hundreds or thousands"
|
||||
TextAnnotation "Vast majority of the changes in composer.lock (to be expected)"
|
||||
TextAnnotation "Half of the changed files are project specific. Could have been 2 or 3 files changed on some projects."
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
There were some autowiring gotchas...
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
``Error: Class 'Symfony\Component\Config\Resource\ClassExistenceResource' not found in Symfony\Component\DependencyInjection\Compiler\AutowirePass->createTypeNotFoundMessage()``
|
||||
|
||||
.. page::
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer require
|
||||
symfony/config:^4``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Composer tried installing version 5 by default, so locked to 4.x."
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
``Cannot autowire service "Drupal\simple_message\DisplaySimpleMessage": argument "$messenger" of method "__construct()" references interface "Drupal\Core\Messenger\MessengerInterface" but no such service exists. You should maybe alias this interface to the existing "messenger" service``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Fixing autowiring
|
||||
=================
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
Drupal\simple_message\DisplaySimpleMessage:
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: event_subscriber }
|
||||
|
||||
Fixing autowiring
|
||||
=================
|
||||
|
||||
.. code-block:: diff
|
||||
|
||||
services:
|
||||
+ Drupal\Core\Messenger\MessengerInterface:
|
||||
+ alias: messenger
|
||||
+ private: true
|
||||
|
||||
Drupal\simple_message\DisplaySimpleMessage:
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: event_subscriber }
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
..
|
||||
|
||||
The big deal about Drupal 9 is... that it should not be a big deal
|
||||
|
||||
-- Dries Buytaert
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Dransible updated in 1-2 hours."
|
||||
TextAnnotation "No big rewrite."
|
||||
TextAnnotation "Smallest core update PR ever!"
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Drupal 10
|
||||
=========
|
||||
|
||||
- Released around June 2022
|
||||
- Drupal 9 EOL around November 2023
|
||||
- Symfony 4 EOL in November 2023
|
||||
- Another easy upgrade
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Need to keep up to date with dependencies."
|
||||
|
||||
Thanks!
|
||||
=======
|
||||
|
||||
References:
|
||||
|
||||
* https://www.drupal.org/docs/understanding-drupal
|
||||
* https://dri.es/drupal-9-0-0-released
|
||||
* https://dri.es/drupal-10-target-release-date-and-drupal-9-end-of-life
|
||||
* https://github.com/opdavies/dransible
|
||||
|
||||
|
|
||||
|
||||
Me:
|
||||
|
||||
* https://www.oliverdavies.uk
|
BIN
fonts/Helvetica-Bold.ttf
Normal file
BIN
fonts/Helvetica.ttf
Normal file
BIN
fonts/Inconsolata-Bold.ttf
Normal file
BIN
fonts/Inconsolata-Regular.ttf
Normal file
BIN
fonts/Inconsolata.ttf
Normal file
BIN
images/bg-dark.png
Normal file
After Width: | Height: | Size: 12 KiB |
11
justfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
_default:
|
||||
@just --list
|
||||
|
||||
generate name theme="light":
|
||||
cd {{ name }} \
|
||||
&& rst2pdf {{ name }}.rst \
|
||||
--break-level 1 \
|
||||
--fit-background-mode scale \
|
||||
--font-path ../fonts \
|
||||
--output {{ name }}.pdf \
|
||||
--stylesheets opdavies-{{ theme }},tango
|
|
@ -1,4 +1,4 @@
|
|||
Building and presenting slide decks with rst2pdf
|
||||
################################################
|
||||
Things to know about PHP
|
||||
========================
|
||||
|
||||
https://www.oliverdavies.uk/talks/building-presenting-slide-decks-rst2pdf
|
||||
https://www.oliverdavies.uk/talks/things-you-should-know-about-php
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
rst2pdf slides.rst
|
||||
|
||||
|
||||
rst2pdf slides.rst --break-level 1 --stylesheets main
|
||||
|
||||
|
||||
rst2pdf slides.rst \
|
||||
--output slides.pdf \
|
||||
--stylesheets main \
|
||||
--break-level 1 \
|
||||
--fit-background-mode scale \
|
||||
--extension-module preprocess
|
|
@ -1,4 +0,0 @@
|
|||
.. code-block:: javascript
|
||||
:include: code/additional-config-options.txt
|
||||
:hl_lines: 2 3 4
|
||||
:linenos:
|
|
@ -1 +0,0 @@
|
|||
.. include:: sections/intro.rst
|
|
@ -1,3 +0,0 @@
|
|||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
|
@ -1,6 +0,0 @@
|
|||
pageTemplates:
|
||||
standardPage:
|
||||
frames: []
|
||||
[3%, 3%, 92%, 92%]
|
||||
showFooter: true
|
||||
showHeader: false
|
|
@ -1,29 +0,0 @@
|
|||
linkColor: #24608a
|
||||
|
||||
styles:
|
||||
normal:
|
||||
fontSize: 24
|
||||
leading: 32
|
||||
textColor: #383745
|
||||
|
||||
bodytext:
|
||||
alignment: TA_LEFT
|
||||
|
||||
heading:
|
||||
fontSize: 20
|
||||
spaceAfter: 16
|
||||
textColor: #24608a
|
||||
|
||||
title:
|
||||
fontSize: 300%
|
||||
parent: heading
|
||||
textColor: white
|
||||
|
||||
bullet-list:
|
||||
commands: []
|
||||
[LEFTPADDING, [0, 0], [1, -1], 10]
|
||||
[RIGHTPADDING, [0, 0], [1, -1], 0]
|
||||
[VALIGN, [0, 0], [-1, -1], TOP]
|
||||
colWidths: ["20", null]
|
||||
textColor: #aaaaaa
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
Building and presenting slide decks with rst2pdf
|
||||
################################################
|
||||
|
||||
.. class:: titleslideinfo
|
||||
|
||||
Oliver Davies (@opdavies)
|
||||
|
||||
|
||||
What is rst2pdf?
|
||||
================
|
||||
|
||||
* "Use a text editor. Make a PDF."
|
||||
* reStructuredText to PDF
|
||||
* Each slide is a page
|
|
@ -1,14 +0,0 @@
|
|||
.. image:: images/editing.png
|
||||
:width: 20cm
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
:startinline: true
|
||||
:linenos:
|
||||
|
||||
echo 'Hello world!';
|
||||
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "This is a speaker note."
|
|
@ -1,8 +0,0 @@
|
|||
nodemon --ext rst,style,txt --exec "
|
||||
rst2pdf slides.rst \
|
||||
--output slides.pdf \
|
||||
--stylesheets main \
|
||||
--break-level 1 \
|
||||
--fit-background-mode scale \
|
||||
--extension-module preprocess
|
||||
"
|
3
things-to-know-php/examples/index.php
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
echo "Hello PHP Stoke";
|
Before Width: | Height: | Size: 389 KiB After Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 526 KiB After Width: | Height: | Size: 479 KiB |
Before Width: | Height: | Size: 530 KiB |
Before Width: | Height: | Size: 637 KiB After Width: | Height: | Size: 821 KiB |
BIN
things-to-know-php/images/php-foundation-website.png
Normal file
After Width: | Height: | Size: 205 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 2.7 MiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 770 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 626 KiB After Width: | Height: | Size: 993 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 2.9 MiB |
Before Width: | Height: | Size: 317 KiB After Width: | Height: | Size: 268 KiB |
129
things-to-know-php/opdavies-dark.style
Normal file
|
@ -0,0 +1,129 @@
|
|||
embeddedFonts: []
|
||||
["Inconsolata.ttf", "Inconsolata.ttf", "Inconsolata.ttf", "Inconsolata.ttf"]
|
||||
["Helvetica.ttf", "Helvetica-Bold.ttf", "Helvetica.ttf", "Helvetica-Bold.ttf"]
|
||||
|
||||
fontsAlias:
|
||||
stdFont: Helvetica
|
||||
stdBold: Helvetica-Bold
|
||||
stdItalic: Helvetica
|
||||
stdMono: Inconsolata
|
||||
stdMonoBold: Inconsolata
|
||||
stdMonoBoldItalic: Inconsolata
|
||||
stdMonoItalic: Inconsolata
|
||||
|
||||
pageSetup:
|
||||
firstTemplate: coverPage
|
||||
height: 18cm
|
||||
margin-bottom: 0cm
|
||||
margin-gutter: 0cm
|
||||
margin-left: 0cm
|
||||
margin-right: 0cm
|
||||
margin-top: 0cm
|
||||
size: null
|
||||
spacing-footer: 2mm
|
||||
spacing-header: 2mm
|
||||
width: 32cm
|
||||
|
||||
pageTemplates:
|
||||
coverPage:
|
||||
# background: images/title.png
|
||||
frames: []
|
||||
[12%, 10%, 76%, 75%]
|
||||
showFooter: false
|
||||
showHeader: false
|
||||
background: ../images/bg-dark.png
|
||||
|
||||
titlePage:
|
||||
alignment: TA_CENTER
|
||||
frames: []
|
||||
[8%, 8%, 85%, 65%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
background: ../images/bg-dark.png
|
||||
|
||||
standardPage:
|
||||
frames: []
|
||||
[3%, 3%, 92%, 92%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
background: ../images/bg-dark.png
|
||||
|
||||
imagePage:
|
||||
alignment: TA_CENTER
|
||||
frames: []
|
||||
[3%, 3%, 92%, 92%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
background: ../images/bg-dark.png
|
||||
|
||||
outputPage:
|
||||
frames: []
|
||||
[8%, 10%, 82%, 65%]
|
||||
showFooter: false
|
||||
showHeader: false
|
||||
background: ../images/bg-dark.png
|
||||
|
||||
linkColor: #60a5fa
|
||||
|
||||
styles:
|
||||
normal:
|
||||
fontSize: 24
|
||||
textColor: #ffffff
|
||||
|
||||
bodytext:
|
||||
alignment: TA_LEFT
|
||||
|
||||
heading:
|
||||
fontName: stdBold
|
||||
fontSize: 20
|
||||
spaceAfter: 16
|
||||
textColor: #60a5fa
|
||||
|
||||
title:
|
||||
fontSize: 300%
|
||||
parent: heading
|
||||
|
||||
bullet-list:
|
||||
commands: []
|
||||
colWidths: ["20", null]
|
||||
textColor: #aaaaaa
|
||||
|
||||
bullet-list-item:
|
||||
spaceBefore: 0
|
||||
spaceAfter: 0
|
||||
|
||||
titleslideinfo:
|
||||
alignment: TA_CENTER
|
||||
fontSize: 140%
|
||||
parent: normal
|
||||
|
||||
footer:
|
||||
alignment: TA_RIGHT
|
||||
fontName: stdMono
|
||||
fontSize: 20
|
||||
textColor: #24608a
|
||||
rightIndent: 16
|
||||
spaceBefore: 0
|
||||
|
||||
literal:
|
||||
backColor: #111111
|
||||
fontName: stdMono
|
||||
|
||||
code:
|
||||
backColor: #0a0a0a
|
||||
borderWidth: 0
|
||||
fontSize: 28
|
||||
leading: 30
|
||||
parent: literal
|
||||
spaceBefore: 4
|
||||
|
||||
centred:
|
||||
alignment: TA_CENTER
|
||||
parent: normal
|
||||
|
||||
centredtitle:
|
||||
alignment: TA_CENTER
|
||||
fontName: stdBold
|
||||
fontSize: 48
|
||||
leading: 64
|
||||
parent: heading
|
124
things-to-know-php/opdavies-light.style
Normal file
|
@ -0,0 +1,124 @@
|
|||
embeddedFonts: []
|
||||
["Inconsolata.ttf", "Inconsolata.ttf", "Inconsolata.ttf", "Inconsolata.ttf"]
|
||||
["Helvetica.ttf", "Helvetica-Bold.ttf", "Helvetica.ttf", "Helvetica-Bold.ttf"]
|
||||
|
||||
fontsAlias:
|
||||
stdFont: Helvetica
|
||||
stdBold: Helvetica-Bold
|
||||
stdItalic: Helvetica
|
||||
stdMono: Inconsolata
|
||||
stdMonoBold: Inconsolata
|
||||
stdMonoBoldItalic: Inconsolata
|
||||
stdMonoItalic: Inconsolata
|
||||
|
||||
pageSetup:
|
||||
firstTemplate: coverPage
|
||||
height: 18cm
|
||||
margin-bottom: 0cm
|
||||
margin-gutter: 0cm
|
||||
margin-left: 0cm
|
||||
margin-right: 0cm
|
||||
margin-top: 0cm
|
||||
size: null
|
||||
spacing-footer: 2mm
|
||||
spacing-header: 2mm
|
||||
width: 32cm
|
||||
|
||||
pageTemplates:
|
||||
coverPage:
|
||||
# background: images/title.png
|
||||
frames: []
|
||||
[12%, 10%, 76%, 75%]
|
||||
showFooter: false
|
||||
showHeader: false
|
||||
|
||||
titlePage:
|
||||
alignment: TA_CENTER
|
||||
frames: []
|
||||
[8%, 8%, 85%, 65%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
|
||||
standardPage:
|
||||
frames: []
|
||||
[3%, 3%, 92%, 92%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
|
||||
imagePage:
|
||||
alignment: TA_CENTER
|
||||
frames: []
|
||||
[3%, 3%, 92%, 92%]
|
||||
showFooter: true
|
||||
showHeader: false
|
||||
|
||||
outputPage:
|
||||
frames: []
|
||||
[8%, 10%, 82%, 65%]
|
||||
showFooter: false
|
||||
showHeader: false
|
||||
|
||||
linkColor: #24608a
|
||||
|
||||
styles:
|
||||
normal:
|
||||
fontSize: 24
|
||||
textColor: #383745
|
||||
|
||||
bodytext:
|
||||
alignment: TA_LEFT
|
||||
|
||||
heading:
|
||||
fontName: stdBold
|
||||
fontSize: 20
|
||||
spaceAfter: 16
|
||||
textColor: #24608a
|
||||
|
||||
title:
|
||||
fontSize: 300%
|
||||
parent: heading
|
||||
|
||||
bullet-list:
|
||||
commands: []
|
||||
colWidths: ["20", null]
|
||||
textColor: #aaaaaa
|
||||
|
||||
bullet-list-item:
|
||||
spaceBefore: 0
|
||||
spaceAfter: 0
|
||||
|
||||
titleslideinfo:
|
||||
alignment: TA_CENTER
|
||||
fontSize: 140%
|
||||
parent: normal
|
||||
|
||||
footer:
|
||||
alignment: TA_RIGHT
|
||||
fontName: stdMono
|
||||
fontSize: 20
|
||||
textColor: #24608a
|
||||
rightIndent: 16
|
||||
spaceBefore: 0
|
||||
|
||||
literal:
|
||||
backColor: white
|
||||
fontName: stdMono
|
||||
|
||||
code:
|
||||
backColor: white
|
||||
borderWidth: 0
|
||||
fontSize: 24
|
||||
leading: 26
|
||||
parent: literal
|
||||
spaceBefore: 4
|
||||
|
||||
centred:
|
||||
alignment: TA_CENTER
|
||||
parent: normal
|
||||
|
||||
centredtitle:
|
||||
alignment: TA_CENTER
|
||||
fontName: stdBold
|
||||
fontSize: 48
|
||||
leading: 64
|
||||
parent: heading
|
|
@ -1,49 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
Levelling Up
|
||||
============
|
||||
|
||||
Content Management Systems
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Move from simple pages or CLI apps, need to level up"
|
||||
|
||||
.. page:: titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
These lists are not exhaustive
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Other CMSes, frameworks and tools are available. These are the ones that came to mind for me."
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/drupal-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/wordpress-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/joomla-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "The big three PHP frameworks."
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/typo3-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/perch-website.png
|
||||
:width: 23cm
|
|
@ -1,86 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Code reuse and collaboration
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
.. image:: images/projects-using-symfony.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/composer-logo.png
|
||||
:height: 10cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/packagist-website.png
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/packagist-symfony-console.png
|
||||
|
||||
.. page:: titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer require
|
||||
symfony/console``
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"require": {
|
||||
"symfony/console": "^4.2"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$app = new \Symfony\Component\Console\Application();
|
||||
$app->run();
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
$app = new Application();
|
||||
$app->run();
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/symfony-components.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/php-fig-website.png
|
||||
:width: 23cm
|
|
@ -1,23 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
The Community
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/php-south-west-website.png
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/php-uk-website.png
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/phpug-website.png
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "These events are happening all over the world, for PHP and for it's sub-communities."
|
||||
TextAnnotation "PHP World, php[tek] (organised by PHP Architect), DrupalCon, SymfonyCon, Laracon, PHP UK, PHP Benelux, Sunshine PHP"
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
Levelling Up
|
||||
============
|
||||
|
||||
Frameworks
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/symfony-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/laravel-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/laminas-website.png
|
||||
:width: 23cm
|
|
@ -1,257 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
How do I get started?
|
||||
|
||||
.. page::
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``php -v``
|
||||
|
||||
.. page::
|
||||
|
||||
``PHP 8.1.0 (cli) (built: Nov 30 2021 07:15:23) (NTS)
|
||||
Copyright (c) The PHP Group
|
||||
Zend Engine v4.1.0, Copyright (c) Zend Technologies``
|
||||
|
||||
.. page::
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``vim index.php``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Create a new file called 'index.php' in the text editor of your choice."
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
Your first PHP file
|
||||
===================
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Add an opening tag (closing tag is optional, and in some cases should not be used)."
|
||||
|
||||
Your first PHP file
|
||||
===================
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
echo 'Hello World';
|
||||
|
||||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``php index.php``
|
||||
|
||||
.. page::
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``php -S localhost:8000``
|
||||
|
||||
.. page:: titlePage
|
||||
|
||||
``/app # php -S localhost:8000``
|
||||
|
||||
``[Tue Mar 8 20:52:39 2022] PHP 8.1.0 Development Server
|
||||
(http://localhost:8000) started``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "PHP's local development web server. Fine for simple scripts or apps."
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/hello-world.png
|
||||
:width: 23cm
|
||||
|
||||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``docker run --rm
|
||||
-v $PWD:/app
|
||||
-w /app
|
||||
php:8.1-cli-alpine
|
||||
php index.php``
|
||||
|
||||
.. page::
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``docker run --rm
|
||||
-v $PWD:/app
|
||||
-w /app
|
||||
php:7.4-cli-alpine
|
||||
php index.php``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "7.4 instead of 8.1"
|
||||
|
||||
.. page::
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``docker run --rm
|
||||
-v $PWD:/var/www/html
|
||||
-p 80:80
|
||||
php:8.1-apache``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Apache rather than CLI"
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say()
|
||||
{
|
||||
echo 'Hello!';
|
||||
}
|
||||
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Global function."
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say($value)
|
||||
{
|
||||
echo $value;
|
||||
}
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say(string $value): void
|
||||
{
|
||||
echo $value;
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "In PHP 7, we can declare type hints on scalar values (e.g. string). Arrays and classes were possible in previous versions."
|
||||
TextAnnotation "We can also declare a return type. In this case, there is nothing returned, so the return type is `void`."
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say(string $value): string
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Return a string rather than echoing a string."
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// src/Person.php
|
||||
|
||||
class Person
|
||||
{
|
||||
public function say(string $value): void
|
||||
{
|
||||
echo $value;
|
||||
}
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Move it into a class called `Person`. Function now becomes a method, though behaves in exactly the same way."
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Version 1.
|
||||
say();
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Version 1.
|
||||
say();
|
||||
|
||||
// Version 2.
|
||||
say('something');
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "First version with no arguments."
|
||||
TextAnnotation "Second version providing the text as an argument."
|
||||
TextAnnotation "Third version using the Person class."
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Version 1.
|
||||
say();
|
||||
|
||||
// Version 2.
|
||||
say('something');
|
||||
|
||||
// Version 3.
|
||||
$person = new Person();
|
||||
$person->say('something');
|
|
@ -1,69 +0,0 @@
|
|||
.. page:: imagePage
|
||||
|
||||
.. image:: images/php-logo.png
|
||||
:width: 15cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Working with PHP and Drupal since 2007 as a hobbyist and Freelancer, full-time since 2010."
|
||||
TextAnnotation "Currently working as a Lead Developer at Transport for Wales."
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
elePHPants!
|
||||
===========
|
||||
|
||||
.. image:: images/elephpants.jpg
|
||||
:width: 23cm
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
What is PHP?
|
||||
============
|
||||
|
||||
PHP is a popular general-purpose scripting language that is especially suited to web development.
|
||||
|
||||
|
|
||||
|
||||
Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.
|
||||
|
||||
|
|
||||
|
||||
http://php.net
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "First released in 2005, most recent release (8.1.3) on 17th February 2022."
|
||||
|
||||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Personal Home Page
|
||||
|
||||
.. page::
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
PHP: Hypertext Preprocessor
|
||||
|
||||
|
|
||||
|
||||
.. class:: centred
|
||||
|
||||
(recursive acronym)
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/php-versions.png
|
||||
:width: 25cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/server-side-languages.png
|
||||
:width: 25cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/content-management-systems.png
|
||||
:width: 25cm
|
|
@ -1,49 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Learning
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/drupalise-me-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/symfonycasts-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/laracasts-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/codecourse-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/zend-certification-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "This leads to achieving certifications which help with personal development and career progression."
|
||||
TextAnnotation "Zend offer certification on the PHP language and formerly on Zend framework (now Laminas)."
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/acquia-certification-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/symfony-certification-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Symfony and Twig"
|
|
@ -1,22 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
But I only need a static site
|
||||
=============================
|
||||
|
||||
Static site generators
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "My personal website falls into this category."
|
||||
TextAnnotation "Write HTML or markdown."
|
||||
TextAnnotation "Use a familiar templating engine like Twig or Laravel's Blade."
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/sculpin-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/jigsaw-website.png
|
||||
:width: 23cm
|
|
@ -1,111 +0,0 @@
|
|||
.. page:: titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Tools
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/composer-logo.png
|
||||
:height: 10cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/xdebug-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Xdebug is a PHP extension that provides debugging and profiling capabilities."
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/xdebug-example.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Add a breakpoint, halts execution"
|
||||
TextAnnotation "Shows a stack trace and variables within scope"
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/phpunit-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. page::
|
||||
|
||||
.. image:: images/pest-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// PHPUnit.
|
||||
|
||||
use App\Email;
|
||||
|
||||
final class EmailTest extends TestCase
|
||||
{
|
||||
public function testCanBeCreatedFromValidEmailAddress(): void
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
Email::class,
|
||||
Email::fromString('user@example.com')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
.. page::
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Pest.
|
||||
|
||||
use App\Email;
|
||||
|
||||
it('can be created from a valid email address', function () {
|
||||
expect(Email::fromString('user@example.com'))
|
||||
->toBeInstanceOf(Email::class);
|
||||
});
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/behat-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Behavior Driven Development (BDD), business-focussed, user story style"
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
.. code-block:: gherkin
|
||||
|
||||
Feature: ls
|
||||
In order to see the directory structure
|
||||
As a UNIX user
|
||||
I need to be able to list the current directory's contents
|
||||
|
||||
Scenario: List 2 files in a directory
|
||||
Given I am in a directory "test"
|
||||
And I have a file named "foo"
|
||||
And I have a file named "bar"
|
||||
When I run "ls"
|
||||
Then I should get:
|
||||
"""
|
||||
bar
|
||||
foo
|
||||
"""
|
||||
|
||||
.. page:: imagePage
|
||||
|
||||
.. image:: images/phpstan-website.png
|
||||
:width: 23cm
|
|
@ -1,58 +0,0 @@
|
|||
.. footer:: @opdavies
|
||||
|
||||
Things to know about PHP
|
||||
########################
|
||||
|
||||
|
|
||||
|
||||
.. class:: titleslideinfo text-white
|
||||
|
||||
Oliver Davies (@opdavies)
|
||||
|
||||
|
|
||||
|
||||
.. class:: centred
|
||||
|
||||
https://oliverdavies.uk/things-about-php
|
||||
|
||||
.. include:: sections/introduction.rst
|
||||
.. include:: sections/getting-started.rst
|
||||
.. include:: sections/cms.rst
|
||||
.. include:: sections/frameworks.rst
|
||||
.. include:: sections/static-site-generators.rst
|
||||
.. include:: sections/code-reuse.rst
|
||||
.. include:: sections/tools.rst
|
||||
.. include:: sections/learning.rst
|
||||
.. include:: sections/community.rst
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
Things you should know about PHP
|
||||
================================
|
||||
|
||||
* Very easy to get started
|
||||
* A large choice of tools and frameworks
|
||||
* A great worldwide community
|
||||
* Great learning resources
|
||||
* Gain experience by contributing to open source projects
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "CMSes, frameworks, eCommerce, APIs, static sites"
|
||||
TextAnnotation "Gain experience and kudos by contributing to open source projects."
|
||||
TextAnnotation "Most of these have their source code posted online with an appropriate license, hosted on GitHub or elsewhere. If you find a bug or want a feature added, you have the ability to create or fix it yourself and contribute it back to the project."
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
Thanks!
|
||||
=======
|
||||
|
||||
References:
|
||||
|
||||
* https://www.oliverdavies.uk/things-about-php
|
||||
|
||||
|
|
||||
|
||||
Me:
|
||||
|
||||
* https://www.oliverdavies.uk
|
892
things-to-know-php/things-to-know-php.rst
Normal file
|
@ -0,0 +1,892 @@
|
|||
.. footer:: @opdavies
|
||||
|
||||
Things to know about PHP
|
||||
########################
|
||||
|
||||
|
|
||||
|
||||
.. class:: titleslideinfo text-white
|
||||
|
||||
Oliver Davies (@opdavies)
|
||||
|
||||
|
|
||||
|
||||
.. class:: centred
|
||||
|
||||
https://oliverdavies.uk/things-about-php
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Contains some code but isn't a walkthrough of the PHP manual."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "For new PHPers this should give you an introduction to PHP and its tooling and community."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/php-logo.png
|
||||
:width: 15cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Working with PHP and Drupal since 2007 as a hobbyist and Freelancer, full-time since 2010."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Currently working as a Lead Developer at Transport for Wales."
|
||||
|
||||
.. Change to a standard page.
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
elePHPants!
|
||||
===========
|
||||
|
||||
.. image:: images/elephpants.jpg
|
||||
:width: 22cm
|
||||
|
||||
What is PHP?
|
||||
============
|
||||
|
||||
PHP is a popular general-purpose scripting language that is especially suited to web development.
|
||||
|
||||
|
|
||||
|
||||
Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.
|
||||
|
||||
|
|
||||
|
||||
http://php.net
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "First released in 2005, most recent release (8.1.3) on 17th February 2022."
|
||||
|
||||
.. Change to a title page.
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Personal Home Page
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
PHP: Hypertext Preprocessor
|
||||
|
||||
|
|
||||
|
||||
.. class:: centred
|
||||
|
||||
(recursive acronym)
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/php-versions.png
|
||||
:width: 24cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "These are the currently supported PHP versions."
|
||||
|
||||
.. image:: images/server-side-languages.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "A lot of projects use PHP!"
|
||||
|
||||
PageBreak
|
||||
|
||||
.. image:: images/content-management-systems.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
How do I get started?
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``php -v``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "How do I know if I have PHP installed and what version?"
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
``PHP 8.1.12 (cli) (built: Oct 25 2022 17:30:00) (ZTS)
|
||||
Copyright (c) The PHP Group
|
||||
Zend Engine v4.1.12, Copyright (c) Zend Technologies``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``vim index.php``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Create a new file called 'index.php' in the text editor of your choice."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Your first PHP file
|
||||
===================
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Add an opening tag (closing tag is optional, and in some cases should not be used)."
|
||||
|
||||
Your first PHP file
|
||||
===================
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
echo 'Hello PHP Stoke';
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``php index.php``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Run a CLI script."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``php -S localhost:8000``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
``/app # php -S localhost:8000``
|
||||
|
||||
``[Thu Jan 12 15:39:41 2023] PHP 8.1.12 Development Server
|
||||
http://localhost:8000) started``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "PHP's local development web server. Fine for simple scripts or apps."
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/hello-world.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``docker run --rm
|
||||
-v $PWD:/app
|
||||
-w /app
|
||||
php:8.1-cli-alpine
|
||||
php index.php``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "If you don't like installing things locally, you can use the official Docker images."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Not a Docker talk..."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``docker run --rm
|
||||
-v $PWD:/app
|
||||
-w /app
|
||||
php:7.4-cli-alpine
|
||||
php index.php``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "7.4 instead of 8.1"
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``docker run --rm
|
||||
-v $PWD:/var/www/html
|
||||
-p 80:80
|
||||
php:8.1-apache``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Apache rather than CLI"
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say()
|
||||
{
|
||||
echo 'Hello!';
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Global function."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Simplest possible PHP script."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say($value)
|
||||
{
|
||||
echo $value;
|
||||
}
|
||||
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Variable interpolation."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Variable could be any number of things."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say(string $value): void
|
||||
{
|
||||
echo $value;
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "In PHP 7, we can declare type hints on scalar values (e.g. string). Arrays and classes were possible in previous versions."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "We can also declare a return type. In this case, there is nothing returned, so the return type is `void`."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Some Developers and teams prefer the minimal approach, some prefer the stricter approach."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// index.php
|
||||
|
||||
function say(string $value): string
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Return a string rather than echoing a string."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
``declare(strict_types=1);``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Enables strict typing."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "If you like types..."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Depends on your preference."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// src/Person.php
|
||||
|
||||
class Person
|
||||
{
|
||||
public function say(string $value): void
|
||||
{
|
||||
echo $value;
|
||||
}
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Object orientated code."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Move it into a class called `Person`. Function now becomes a method, though behaves in exactly the same way."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Version 1.
|
||||
say();
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "This is how to call a global function."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Version 1.
|
||||
say();
|
||||
|
||||
// Version 2.
|
||||
say('something');
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Still calling a global function with and without arguments."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "First version with no arguments."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Second version providing the text as an argument."
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Version 1.
|
||||
say();
|
||||
|
||||
// Version 2.
|
||||
say('something');
|
||||
|
||||
// Version 3.
|
||||
$person = new Person();
|
||||
$person->say('something');
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Third version using the Person class."
|
||||
PageBreak titlePage
|
||||
|
||||
Levelling Up
|
||||
============
|
||||
|
||||
Content Management Systems
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Move from simple pages or CLI apps, need to level up"
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
These lists are not exhaustive
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Other CMSes, frameworks and tools are available. These are the ones that came to mind for me."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/drupal-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. image:: images/wordpress-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. image:: images/joomla-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "The big three PHP frameworks."
|
||||
|
||||
.. image:: images/typo3-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
Levelling Up
|
||||
============
|
||||
|
||||
Frameworks
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/symfony-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. image:: images/laravel-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. image:: images/laminas-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
But I only need a static site
|
||||
=============================
|
||||
|
||||
Static site generators
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "My personal website falls into this category."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Write HTML or markdown."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Use a familiar templating engine like Twig or Laravel's Blade."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/sculpin-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. image:: images/jigsaw-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Code reuse and collaboration
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/projects-using-symfony.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/composer-logo.png
|
||||
:height: 10cm
|
||||
|
||||
.. image:: images/packagist-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/packagist-symfony-console.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredtitle
|
||||
|
||||
``composer require
|
||||
symfony/console``
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"require": {
|
||||
"symfony/console": "^4.2"
|
||||
}
|
||||
}
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$app = new \Symfony\Component\Console\Application();
|
||||
$app->run();
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
$app = new Application();
|
||||
$app->run();
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/symfony-components.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/php-fig-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/php-foundation-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation " The PHP Foundation is a collective established with the non-profit mission to support, advance, and develop the PHP language. We are a community of PHP veterans, community leaders, and technology companies that rely on PHP as a critical digital infrastructure. We collaborate to ensure PHP language long-term success and maintenance."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Tools
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/composer-logo.png
|
||||
:height: 10cm
|
||||
|
||||
.. image:: images/xdebug-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Xdebug is a PHP extension that provides debugging and profiling capabilities."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak
|
||||
|
||||
.. image:: images/xdebug-example.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Add a breakpoint, halts execution"
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Shows a stack trace and variables within scope"
|
||||
|
||||
.. image:: images/phpunit-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/pest-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// PHPUnit.
|
||||
|
||||
use App\Email;
|
||||
|
||||
final class EmailTest extends TestCase
|
||||
{
|
||||
public function testCanBeCreatedFromValidEmailAddress(): void
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
Email::class,
|
||||
Email::fromString('user@example.com')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
.. code-block:: php
|
||||
:linenos:
|
||||
|
||||
<?php
|
||||
|
||||
// Pest.
|
||||
|
||||
use App\Email;
|
||||
|
||||
it('can be created from a valid email address', function () {
|
||||
expect(Email::fromString('user@example.com'))
|
||||
->toBeInstanceOf(Email::class);
|
||||
});
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/behat-website.png
|
||||
:width: 23cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Behavior Driven Development (BDD), business-focussed, user story style"
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
.. code-block:: gherkin
|
||||
|
||||
Feature: ls
|
||||
In order to see the directory structure
|
||||
As a UNIX user
|
||||
I need to be able to list the current directory's contents
|
||||
|
||||
Scenario: List 2 files in a directory
|
||||
Given I am in a directory "test"
|
||||
And I have a file named "foo"
|
||||
And I have a file named "bar"
|
||||
When I run "ls"
|
||||
Then I should get:
|
||||
"""
|
||||
bar
|
||||
foo
|
||||
"""
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/phpstan-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
Learning
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/drupalise-me-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/symfonycasts-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/laracasts-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/codecourse-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/zend-certification-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "This leads to achieving certifications which help with personal development and career progression."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Zend offer certification on the PHP language and formerly on Zend framework (now Laminas)."
|
||||
|
||||
.. image:: images/acquia-certification-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. image:: images/symfony-certification-website.png
|
||||
:width: 22cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Symfony and Twig"
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak titlePage
|
||||
|
||||
.. class:: centredTitle
|
||||
|
||||
The Community
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak imagePage
|
||||
|
||||
.. image:: images/php-south-west-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. image:: images/php-uk-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. image:: images/phpug-website.png
|
||||
:width: 24cm
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "These events are happening all over the world, for PHP and for it's sub-communities."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "PHP World, php[tek] (organised by PHP Architect), DrupalCon, SymfonyCon, Laracon, PHP UK, PHP Benelux, Sunshine PHP"
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Things you should know about PHP
|
||||
================================
|
||||
|
||||
* Very easy to get started
|
||||
* A large choice of tools and frameworks
|
||||
* A great worldwide community
|
||||
* Great learning resources
|
||||
* Gain experience by contributing to open source projects
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "CMSes, frameworks, eCommerce, APIs, static sites"
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Gain experience and kudos by contributing to open source projects."
|
||||
TextAnnotation ""
|
||||
TextAnnotation "Most of these have their source code posted online with an appropriate license, hosted on GitHub or elsewhere. If you find a bug or want a feature added, you have the ability to create or fix it yourself and contribute it back to the project."
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak standardPage
|
||||
|
||||
Thanks!
|
||||
=======
|
||||
|
||||
References:
|
||||
|
||||
* https://www.oliverdavies.uk/things-about-php
|
||||
|
||||
|
|
||||
|
||||
Me:
|
||||
|
||||
* https://www.oliverdavies.uk
|
||||
* https://www.oliverdavies.uk/links
|
||||
* https://www.oliverdavies.uk/daily
|