Skip to content

Commit

Permalink
Updates demo:
Browse files Browse the repository at this point in the history
1. Add var-dumper code highlight
2. Improves profiler report
3. Adds attachment for smtp
  • Loading branch information
butschster committed Jun 11, 2024
1 parent cea8d2e commit 93fe691
Show file tree
Hide file tree
Showing 8 changed files with 10,020 additions and 7 deletions.
13 changes: 10 additions & 3 deletions app/Mail/WelcomeMail.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

declare(strict_types=1);

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Queue\SerializesModels;

class WelcomeMail extends Mailable
{
//use Queueable, SerializesModels;

public function __construct()
{
}
public function __construct() {}

/**
* Build the message.
Expand All @@ -25,4 +25,11 @@ public function build()
return $this
->markdown('emails.welcome');
}

public function attachments()
{
return [
Attachment::fromPath(app()->resourcePath('images/logo.svg'))->as('logo'),
];
}
}
6 changes: 6 additions & 0 deletions app/Modules/Profiler/Common.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

declare(strict_types=1);

namespace App\Modules\Profiler;

use App\MyService\MyService;

trait Common
{
public function setupProfiler(): void
Expand All @@ -14,5 +17,8 @@ public function setupProfiler(): void
/** @test */
function profilerReport(): void
{
\usleep(10_000);

app(MyService::class)->call();
}
}
33 changes: 31 additions & 2 deletions app/Modules/VarDump/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ function varDumpBool(): void
/** @test */
function varDumpInt(): void
{
dump(4, 8, 15, 16, 23, 42);
dump(
four: 4,
eight: 8,
fifteen: 15,
sixteen: 16,
twentythree: 23,
fortytwo: 42,
);
}

/** @test */
Expand All @@ -50,7 +57,29 @@ function varDumpObject(RandomPhraseGenerator $generator): void
$object->funnyFact = $generator->generate('Buggregator');

dump($object);
dump(ray());
}

/** @test */
function varDumpCode(RandomPhraseGenerator $generator): void
{
trap(
sprintf(
<<<PHP
<?php
declare(strict_types=1);
final class Buggregator
{
public function dump(): string
{
return '%s';
}
}
PHP,
$generator->generate('Buggregator'),
),
)->code('php');
}

/** @test */
Expand Down
22 changes: 22 additions & 0 deletions app/MyService/MyService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\MyService;

use App\Models\User;

final class MyService
{
public function __construct() {}

public function call(): array
{
$result = [];
for ($i = 0; $i < 1_000; $i++) {
$result[] = User::factory()->makeOne();
}

return $result;
}
}
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"spiral-packages/profiler": "^1.0"
},
"require-dev": {
"buggregator/trap": "^1.9",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"phpunit/phpunit": "^9.3.3"
Expand Down Expand Up @@ -55,7 +56,10 @@
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
Loading

0 comments on commit 93fe691

Please sign in to comment.