diff --git a/composer.lock b/composer.lock index b09e443..a7cd283 100644 --- a/composer.lock +++ b/composer.lock @@ -54,31 +54,31 @@ }, { "name": "league/flysystem", - "version": "1.0.64", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0" + "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d13c43dbd4b791f815215959105a008515d1a2e0", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32", + "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": ">=5.5.9" + "league/mime-type-detection": "^1.3", + "php": "^7.2.5 || ^8.0" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.26" + "phpspec/prophecy": "^1.11.1", + "phpunit/phpunit": "^8.5.8" }, "suggest": { - "ext-fileinfo": "Required for MimeType", "ext-ftp": "Allows you to use FTP server storage", "ext-openssl": "Allows you to use FTPS server storage", "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", @@ -134,7 +134,73 @@ "sftp", "storage" ], - "time": "2020-02-05T18:14:17+00:00" + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/1.1.4" + }, + "funding": [ + { + "url": "https://offset.earth/frankdejonge", + "type": "other" + } + ], + "time": "2021-06-23T21:56:05+00:00" + }, + { + "name": "league/mime-type-detection", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", + "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.18", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Mime-type detection for Flysystem", + "support": { + "issues": "https://github.com/thephpleague/mime-type-detection/issues", + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2021-01-18T20:58:21+00:00" }, { "name": "psalm/phar", @@ -169,20 +235,23 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.14.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" @@ -190,16 +259,20 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -223,24 +296,44 @@ "polyfill", "portable" ], - "time": "2020-01-13T11:15:53+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.14.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { "ext-mbstring": "For best performance" @@ -248,16 +341,20 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -282,35 +379,52 @@ "portable", "shim" ], - "time": "2020-01-13T11:15:53+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" }, { "name": "twig/twig", - "version": "v3.0.3", + "version": "v3.4.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3b88ccd180a6b61ebb517aea3b1a8906762a1dc2" + "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3b88ccd180a6b61ebb517aea3b1a8906762a1dc2", - "reference": "3b88ccd180a6b61ebb517aea3b1a8906762a1dc2", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58", + "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": ">=7.2.5", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.0" + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -344,7 +458,21 @@ "keywords": [ "templating" ], - "time": "2020-02-11T15:33:47+00:00" + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.4.3" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2022-09-28T08:42:51+00:00" } ], "packages-dev": [], @@ -354,5 +482,6 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.3.0" } diff --git a/content/01-introduction.md b/content/01-introduction.md index fd334af..b739026 100644 --- a/content/01-introduction.md +++ b/content/01-introduction.md @@ -9,7 +9,7 @@ This is for anyone who wants to learn to program in PHP. You should probably already know at least one programming language with curly braces, if conditions, variables, functions and loops. The most likely scenario is that you are a Javascript or Typescript developer, working on a team that uses a combination of PHP and JS or TS, and while you might not currently need deep PHP knowledge, -you want 'T-shaped skills', involving basic PHP knowledge. There will be some comparisons between with Javascript and +you want 'T-shaped skills', involving basic PHP knowledge. There will be some comparisons with Javascript and Typescript. ### Why did I write it? @@ -27,4 +27,4 @@ PHP is an old language that has evolved organically over the years. There are ma and many parts of the language that are best avoided in new code. This tutorial will concentrate on recommended ways to use PHP, and ignore most of the things that PHP allows you to do but you probably shouldn't. -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/content/02-getting-php.md b/content/02-getting-php.md index 705d78d..ad8ddfa 100644 --- a/content/02-getting-php.md +++ b/content/02-getting-php.md @@ -7,7 +7,7 @@ online at [3v4l](https://3v4l.org/), but to work through this tutorial you shoul ### Installation -First check if you already have PHP installed. Open your command-line prompt, and type `php --v`. If you have PHP, you +First check if you already have PHP installed. Open your command-line prompt, and type `php -v`. If you have PHP, you should see something like: ``` @@ -44,4 +44,4 @@ package bundles PHP along with the Apache web server, MariaDB database server, a for Linux and Macintosh. Run `php -v` again. Hopefully you will now have version **7.2 or later**. -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/content/05-variables.md b/content/05-variables.md index 44531f8..79cf9e8 100644 --- a/content/05-variables.md +++ b/content/05-variables.md @@ -2,7 +2,7 @@ {% block body%} -Variables in PHP always have a dollar sign `$` at the start of their names, and you declare a variable by assigning a +Variables in PHP always have a dollar sign like `$` at the start of their names, and you declare a variable by assigning a value to it. PHP *interpolates* double-quoted strings with variables. Edit hello.php to use a variable: ```php @@ -105,4 +105,4 @@ $planetPopulations = [ echo "The population of Earth is {$planetPopulations['Earth']}.\n"; ``` -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/content/08-classes-2.md b/content/08-classes-2.md index 7889672..c948c32 100644 --- a/content/08-classes-2.md +++ b/content/08-classes-2.md @@ -13,7 +13,7 @@ By convention, and to follow the [PSR-1](https://www.php-fig.org/psr/psr-1/) cod point in a separate file to the class declaration. Let's write a simple script to create a planet and print out its details. Since at the moment Planet is just a data -holder the script won't be too exiting. +holder the script won't be too exciting. Write the following in a file called start.php @@ -127,7 +127,7 @@ As long as we keep our file names matching our class names, Composer will automa only when we need it. Of course technically we haven't got rid of the `require_once` statement, but by requiring the autoloader we won't -need to add any more require statements, however classes we use in our program. +need to add any more require statements, however many classes we use in our program. If you run `php start.php` you should once again learn the population of Neptune. -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/content/10-testing.md b/content/10-testing.md index 321aa66..d2e4fec 100644 --- a/content/10-testing.md +++ b/content/10-testing.md @@ -45,7 +45,7 @@ won't install that unless we edit composer json. Composer works best with depend Composer has also created a new file for us, `composer.lock`. This has metadata about the exact versions of the packages installed. At the time of writing it shows me that PHPUnit is at version 9.0.1, and I can see the details of 29 other packages that have been installed because PHPUnit depends on them directly or indirectly. The `composer show` command -will output the list of installed packages in a much more consice format. +will output the list of installed packages in a much more concise format. ### Writing a test diff --git a/content/11-databases.md b/content/11-databases.md index 8438fb5..5e9009d 100644 --- a/content/11-databases.md +++ b/content/11-databases.md @@ -41,7 +41,7 @@ Once you've found the package name, e.g. `php7.4-sqlite3` install it with a comm ### Mac -If you installed PHP via homebrew, I think will automatically have come with SQLite built in and enabled. +If you installed PHP via homebrew, I think it will automatically have come with SQLite built in and enabled. ### Windows diff --git a/content/12-templating.md b/content/12-templating.md index bdaeeef..83b5822 100644 --- a/content/12-templating.md +++ b/content/12-templating.md @@ -92,7 +92,7 @@ expect to have a `planet` variable, and it will be of type `Planet`. Add the fol ``` In Twig we use double curly brackets to output dynamic data: Replace `Some Planet` with -`{{planet.name}}`, and replace `34601` with `{{planet.populationSize}}`. Twig knows that we mean `getName` and +`{{'{{planet.name}}'}}`, and replace `34601` with `{{'{{planet.populationSize}}'}}`. Twig knows that we mean `getName` and `getPopulationSize`, so we don't have to write those function names out in full. If you reload the page you should now see the planet details in their proper places. diff --git a/content/14-what-next.md b/content/14-what-next.md index 693de04..5993044 100644 --- a/content/14-what-next.md +++ b/content/14-what-next.md @@ -47,7 +47,7 @@ to install a library or tool. * [Subscribe](https://info.jetbrains.com/PHP-Annotated-Subscription.html) to [PHP Annotated Monthly](https://blog.jetbrains.com/phpstorm/category/php-annotated-monthly/) from the makers of -[PhpStorm](https://www.jetbrains.com/phpstorm/), for interesting links every Month. +[PhpStorm](https://www.jetbrains.com/phpstorm/), for interesting links every month. * And finally, read [Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations](https://itrevolution.com/book/accelerate/), by [Nicole Forsgren](https://twitter.com/nicolefv), @@ -59,4 +59,4 @@ the most important book for anyone making software in an organisation to read. organisations need to develop and maintain to perform well with software. You can also read about those capabilities in the briefer and slightly more up-to date form of the [2019 Accelerate State of DevOps Report](https://cloud.google.com/devops/state-of-devops/). -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/css/styles.css b/css/styles.css index bcfcff8..0bc453f 100644 --- a/css/styles.css +++ b/css/styles.css @@ -4,31 +4,30 @@ justify-content: center; flex-flow: column wrap; align-content: stretch; - max-height: 13em; } -@media (max-width: 1000px) { +@media (min-width: 1000px) { #pages ul { - max-height: none; + max-height: 13em; } } #pages ul li { - margin: 0.2em 1em; + margin: 0.2em 1em 0.2em 0; min-width: 20em; - display: block; + list-style: none; flex: 1 1 0; - border-bottom: 0.1em rgba(0,0,0,0) solid; - padding-bottom: 0.1em; + border-bottom: 1px transparent solid; + padding-bottom: 1px; } #pages ul li.current { - list-style: disc; - border-bottom-color: black; + border-bottom-color: inherit; } #pages ul li.current a { color: inherit; + text-decoration: none; } body > div { diff --git a/readme.md b/readme.md index ed067ab..ea14392 100644 --- a/readme.md +++ b/readme.md @@ -9,4 +9,4 @@ Some more notes on how this is should be different to what's already out there a Read the website at https://a-moderately-short-php-tutorial.com/ -CircleCI is configured to to rebuild the website based on any changes in the repository. \ No newline at end of file +CircleCI is [configured](./.circleci/config.yml) to to rebuild the website based on any changes in the repository. diff --git a/templates/layout.html.twig b/templates/layout.html.twig index a462989..882f62f 100644 --- a/templates/layout.html.twig +++ b/templates/layout.html.twig @@ -3,6 +3,8 @@ + + {{ title }} | A Moderately Short PHP Tutorial @@ -11,21 +13,8 @@ - - - + + @@ -68,7 +57,7 @@