Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Laravel 11 and make use of common/markdown #1439

Merged
merged 5 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
APP_ENV=dev
APP_DEBUG=true
APP_KEY=random_key
APP_KEY=base64:NKiscQs2YqBLEa8qt7cbRKNCUef6LvD7PR5PQW7wDTk=
APP_URL=http://localhost

# required for Laravel defautlst to work
DB_CONNECTION=sqlite
DB_DATABASE=database/database.sqlite
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running php82 artisan cache:clear seems got error:

➜  tomasvotruba.com git:(tv-laravel-11) php82 artisan cache:clear

In Connection.php line 806:
                                                                                                         
  SQLSTATE[HY000]: General error: 1 no such table: cache (Connection: sqlite, SQL: delete from "cache")  
                                                                                                         

In Connection.php line 585:
                                                          
  SQLSTATE[HY000]: General error: 1 no such table: cache  

The website seems ok, but it seems this issue for clearing cache process. I will look more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, cache migration table seems not exists, I will add it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 changes: 5 additions & 1 deletion .env.prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
APP_ENV=prod
APP_DEBUG=false
APP_KEY=random_key
APP_KEY=base64:NKiscQs2YqBLEa8qt7cbRKNCUef6LvD7PR5PQW7wDTk=
APP_URL=https://tomasvotruba.com

# required for Laravel defautlst to work
DB_CONNECTION=sqlite
DB_DATABASE=database/database.sqlite
2 changes: 1 addition & 1 deletion .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
# needed by phpunit
extensions: mbstring
# disable xdebug
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
-
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2

- uses: "ramsey/composer-install@v1"

Expand Down
20 changes: 0 additions & 20 deletions app/Http/HttpKernel.php

This file was deleted.

17 changes: 9 additions & 8 deletions app/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

declare(strict_types=1);

function fast_markdown(string $markdownContents): string
{
/** @var Parsedown $parsedown */
$parsedown = app(Parsedown::class);
// @see https://github.com/thephpleague/commonmark

return $parsedown->parse($markdownContents);
}
use League\CommonMark\GithubFlavoredMarkdownConverter;

function nice_number(float $number): string
function markdown(string $contents): Stringable
{
return number_format($number, 2, ',', ' ');
$markdownConverter = new GithubFlavoredMarkdownConverter([
'html_input' => 'strip',
'allow_unsafe_links' => false,
]);

return $markdownConverter->convert($contents);
}
46 changes: 2 additions & 44 deletions artisan
Original file line number Diff line number Diff line change
@@ -1,53 +1,11 @@
#!/usr/bin/env php
<?php

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
declare(strict_types=1);

require __DIR__.'/vendor/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);

$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);

/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/

$kernel->terminate($input, $status);
$status = $app->handleCommand(new \Symfony\Component\Console\Input\ArgvInput());

exit($status);
26 changes: 14 additions & 12 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
declare(strict_types=1);

use Illuminate\Foundation\Application;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Foundation\Exceptions\Handler;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Foundation\Configuration\Exceptions;

$application = new Application(__DIR__ . '/..');

$application->singleton(Kernel::class, App\Http\HttpKernel::class);

$application->singleton(Illuminate\Contracts\Console\Kernel::class,\Illuminate\Foundation\Console\Kernel::class);

$application->singleton(ExceptionHandler::class, Handler::class);

return $application;
return Application::configure()
->withProviders()
->withRouting(
web: __DIR__.'/../routes/web.php',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})
->create();
33 changes: 10 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
{
"name": "tomasvotruba/website",
"type": "project",
"license": "MIT",
"description": "Blog about hacking PHP, education and being the laziest PHP programmer in the world",
"require": {
"php": ">=8.1",
"php": "^8.2",
"ext-gd": "*",
"ext-mbstring": "*",
"erusev/parsedown": "^1.7",
"imagine/imagine": "^1.3",
"laravel/framework": "^10.19",
"laravel/framework": "11.x-dev",
"league/commonmark": "^2.4.1",
"nette/utils": "^4.0",
"spatie/laravel-markdown": "^2.4",
"symfony/yaml": "^6.3",
"symplify/vendor-patches": "^11.2",
"tomasvotruba/punchcard": "^0.2"
"symfony/yaml": "^6.4"
},
"require-dev": {
"nunomaduro/larastan": "^2.6",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^1.10.55",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^10.5",
"rector/rector": "dev-main",
"symplify/easy-coding-standard": "^12.0",
"symplify/phpstan-extensions": "^11.3",
"tomasvotruba/bladestan": "^0.4.1"
"symplify/easy-coding-standard": "^12.1",
"symplify/phpstan-extensions": "^11.4",
"tomasvotruba/bladestan": "^0.5"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -54,18 +52,7 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true,
"cweagans/composer-patches": true
}
},
"extra": {
"patches": {
"spatie/commonmark-shiki-highlighter": [
"patches/spatie-commonmark-shiki-highlighter-src-shikihighlighter-php.patch"
],
"spatie/shiki-php": [
"patches/spatie-shiki-php-src-shiki-php.patch"
]
"phpstan/extension-installer": true
}
}
}
Loading
Loading