PHP code example of torchlight / torchlight-jigsaw

1. Go to this page and download the library: Download torchlight/torchlight-jigsaw library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

torchlight / torchlight-jigsaw example snippets


Torchlight\Jigsaw\TorchlightExtension::make($container, $events)->boot();



use App\Listeners\GenerateSitemap;
use TightenCo\Jigsaw\Jigsaw;

/** @var $container \Illuminate\Container\Container */
/** @var $events \TightenCo\Jigsaw\Events\EventBus */

/**
 * You can run custom code at different stages of the build process by
 * listening to the 'beforeBuild', 'afterCollections', and 'afterBuild' events.
 *
 * For example:
 *
 * $events->beforeBuild(function (Jigsaw $jigsaw) {
 *     // Your code here
 * });
 */

$events->afterBuild(GenerateSitemap::class);

Torchlight\Jigsaw\TorchlightExtension::make($container, $events)->boot();

return [
    // Which theme you want to use. You can find all of the themes at
    // https://torchlight.dev/themes, or you can provide your own.
    'theme' => 'material-theme-palenight',

    // Your API token from torchlight.dev.
    'token' => '',

    // If you want to register the blade directives, set this to true.
    'blade_components' => true,

    // The Host of the API.
    'host' => 'https://api.torchlight.dev',

    // If you want to specify the cache path, you can do so here. Note
    // that you should *not* use the same path that Jigsaw uses,
    // which is `cache` at the root level of your app.
    'cache_path' => 'torchlight_cache',
];

echo "here is my code"
 {#some-html-id.mt-4.mb-8}
echo "here is my code"
blade
<pre><x-torchlight-code language='php'>
    echo "hello world";
</x-torchlight-code></pre>
blade
<pre><x-torchlight-code id='hello-world' class='mt-4 mb-8' language='php'>
    echo "hello world";
</x-torchlight-code></pre>