Artisan の tinker コマンドは、ターミナルでアプリケーションをいじるのに最適な方法です。残念ながら、数行のコードを実行し、編集し、コードをコピー/ペーストするのは面倒な場合があります。ブラウザをいじってみるのは素晴らしいと思いませんか?
このパッケージは、心ゆくまでいじることができるルートをアプリケーションに追加します。
光が目を痛める場合に備えて、ダークモードもあります。
私たちはクラス最高のオープンソース パッケージの作成に多くのリソースを投資しています。有料製品のいずれかを購入することで、私たちをサポートできます。
当社のどのパッケージを使用しているかについて、故郷から葉書を送っていただき、誠にありがとうございます。当社の住所は、お問い合わせページに記載されています。受け取ったすべてのポストカードをバーチャル ポストカード ウォールに公開します。
このパッケージは任意のコードを実行できます。自分が何をしているのか理解していない限り、実稼働環境や実世界のデータを扱う環境にこれをインストールしたり使用したりしないでください。
パッケージは、composer 経由でインストールできます。
composer require spatie/laravel-web-tinker --dev
次に、このコマンドを実行して、このパッケージからアセットを公開する必要があります。
php artisan web-tinker:install
必要に応じて、パッケージの構成ファイルを公開できます。
php artisan vendor:publish --provider= " SpatieWebTinkerWebTinkerServiceProvider " --tag= " config "
これはconfig/web-tinker.php
に公開されるコンテンツです
return [
/*
* The web tinker page will be available on this path.
*/
' path ' => ' /tinker ' ,
/*
* Possible values are 'auto', 'light' and 'dark'.
*/
' theme ' => ' auto ' ,
/*
* By default this package will only run in local development.
* Do not change this, unless you know what your are doing.
*/
' enabled ' => env ( ' APP_ENV ' ) === ' local ' ,
/*
* This class can modify the output returned by Tinker. You can replace this with
* any class that implements SpatieWebTinkerOutputModifiersOutputModifier.
*/
' output_modifier ' => Spatie WebTinker OutputModifiers PrefixDateTime::class,
/*
* These middleware will be assigned to every WebTinker route, giving you the chance
* to add your own middlewares to this list or change any of the existing middleware.
*/
' middleware ' => [
Illuminate Cookie Middleware EncryptCookies::class,
Illuminate Session Middleware StartSession::class,
Spatie WebTinker Http Middleware Authorize::class,
],
/*
* If you want to fine-tune PsySH configuration specify
* configuration file name, relative to the root of your
* application directory.
*/
' config_file ' => env ( ' PSYSH_CONFIG ' , null ),
];
デフォルトでは、このパッケージはローカル環境でのみ実行されます。
アプリのローカル環境で/tinker
アクセスして、tinker ページを表示します。
これを別の環境で実行したい場合 (これはお勧めしません)、実行する必要がある手順が 2 つあります。
viewWebTinker
機能を登録する必要があります。これを行うには、Laravel に同梱されているAuthServiceProvider
内が適しています。 public function boot ()
{
$ this -> registerPolicies ();
Gate:: define ( ' viewWebTinker ' , function ( $ user = null ) {
// return true if access to web tinker is allowed
});
}
web-tinker
構成ファイル内のenabled
変数をtrue
に設定する必要があります。 web-tinker
構成ファイルのoutput_modifier
キーで出力修飾子を指定することで、tinker の出力を変更できます。出力修飾子は、 SpatieWebTinkerOutputModifiersOutputModifier
実装する任意のクラスです。
そのインターフェースは次のようになります。
namespace Spatie WebTinker OutputModifiers ;
interface OutputModifier
{
public function modify ( string $ output = '' ): string ;
}
このパッケージのデフォルトのインストールでは、Tinker からの出力の前に現在の日付時刻を付けるPrefixDataTime
出力修飾子が使用されます。
composer test
最近の変更点の詳細については、CHANGELOG を参照してください。
詳細については、「貢献」を参照してください。
セキュリティに関するバグを見つけた場合は、問題トラッカーを使用する代わりに [email protected] にメールを送信してください。
このパッケージは、Marcel Pociot による nova-tinker-tool パッケージからインスピレーションを得て、そのコードを使用しています。
MIT ライセンス (MIT)。詳細については、ライセンス ファイルを参照してください。