The following regex will convert old, closure-based view routes from:
Route::get('faq', function () {
return view('faq');
});
to the new, cacheable Route::view()
introduced in Laravel 5.5.
# ref: https://twitter.com/gonedark/status/1174460639005356032 | |
# usage: fixup [ref] | |
function fixup() { | |
git commit --fixup="$1" | |
GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash "$1"~1 | |
} | |
# credit: https://stackoverflow.com/questions/29094595/git-interactive-rebase-without-opening-the-editor |
<?php | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'binary_operator_spaces' => [ | |
'operators' => ['=>' => null] | |
], | |
'blank_line_after_namespace' => true, |
# Run `artisan make:test` for all Controllers under `your app/Http/Controllers` folder. | |
# Created tests mirror their path under the `app` folder and are suffixed with "Test". | |
find app/Http/Controllers -type f -name '*Controller.php' -exec sh -c 'php artisan make:test $(dirname "${1:4}")/$(basename "$1" .php)Test' sh {} \; |
<?php | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'phpdoc_indent' => true, | |
'binary_operator_spaces' => [ | |
'operators' => ['=>' => null] | |
], |
<?php | |
require 'vendor/autoload.php'; | |
$renamed_posts = []; | |
foreach (new DirectoryIterator('source/_posts') as $file) { | |
if (!$file->isFile()) { | |
continue; | |
} |
<?php | |
require 'vendor/autoload.php'; | |
$parser = new \Mni\FrontYAML\Parser(); | |
$config = [ | |
'whitelist' => ['title', 'excerpt', 'comments', 'categories', 'seo_image'], | |
'merge' => [ | |
'extends' => '_layouts.post', |
<?php | |
return [ | |
'baseUrl' => 'https://jasonmccreary.me', | |
'production' => true, | |
'siteName' => 'Jason McCreary', | |
'siteTitle' => 'I build things with my hands', | |
'siteDescription' => 'I build things with my hands', | |
'siteAuthor' => 'Jason McCreary', |
The following regex will convert old, closure-based view routes from:
Route::get('faq', function () {
return view('faq');
});
to the new, cacheable Route::view()
introduced in Laravel 5.5.
To prepare for this workshop, attendees should clone or download the start-testing-php repository and run composer install
. This will install all the necessary tools to follow along with the live coding demos.
While only PHP and Composer are required, if you would like to take the opportunity to set up a complete, local development environment, check out Homestead or Docker.
These resources are either referenced during my Getting Git workshop or serve as materials for additional learning.
In addition, the Getting Git workshop is based on the Getting Git video course. This can not only serve as a refresher, but also cover more commands and scenarios than the workshop.