いまの PHP は、多くの人が思い浮かべる PHP とはまったく別物です。だからこそ言葉で説明するより画像で見せる価値があります。
Codeshotは貼り付けたコードからPHPを判別するので、言語の選び間違いは起きません。付属する30種類のうち3つのテーマで同じスニペットを、アプリ自身のスタイルシートで表示しています。
PHP
PHPのスニペットを、Macから離れることなく共有したくなる画像に。
いまの PHP は、多くの人が思い浮かべる PHP とはまったく別物です。だからこそ言葉で説明するより画像で見せる価値があります。
Codeshotは貼り付けたコードからPHPを判別するので、言語の選び間違いは起きません。付属する30種類のうち3つのテーマで同じスニペットを、アプリ自身のスタイルシートで表示しています。
<?php
final class Snapshot
{
public function __construct(
private string $code,
private string $theme = 'xcode',
) {}
public function export(string $path, int $scale = 2): bool
{
return Renderer::render($this->code, $this->theme)->save($path, $scale);
}
}
<?php
final class Snapshot
{
public function __construct(
private string $code,
private string $theme = 'xcode',
) {}
public function export(string $path, int $scale = 2): bool
{
return Renderer::render($this->code, $this->theme)->save($path, $scale);
}
}
<?php
final class Snapshot
{
public function __construct(
private string $code,
private string $theme = 'xcode',
) {}
public function export(string $path, int $scale = 2): bool
{
return Renderer::render($this->code, $this->theme)->save($path, $scale);
}
}
型付きプロパティやコンストラクタプロモーションのおかげで、コードは短くまとまります。何の言語か一目でわかるよう、開始タグは画面内に残しておきましょう。
画像サイズを内容に合わせるか、比率で固定します(1:1、4:3、3:2、16:9、9:16、2:3、3:4)。そのうえで1×・2×・3×から選んで書き出せば、Retinaディスプレイでも鮮明なままです。⌘⇧Cでクリップボードに直接コピー、または⌘Sで保存できます。
30種類のテーマを見比べるか、全体の流れをご覧ください。
すべてMac上で動作します。コードが外に出ることはありません。