PHP code example of authorod / svitylo-anatomy-laravel

1. Go to this page and download the library: Download authorod/svitylo-anatomy-laravel 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/ */

    

authorod / svitylo-anatomy-laravel example snippets


use Authorod\SvityloAnatomy\CommonMark\AnatomyExtension;

$html = Str::markdown($text, [], [app(SvityloAnatomy::class)->extension()]);
// or new AnatomyExtension(['data_url' => '/anatomy-data/1.1.0/', 'share_urls' => [...]])

use Authorod\SvityloAnatomy\Sanitizer\AnatomySanitizer;
use Symfony\Component\HtmlSanitizer\{HtmlSanitizer, HtmlSanitizerConfig};

$config = AnatomySanitizer::allowBlocks((new HtmlSanitizerConfig())->allowSafeElements());
$clean = (new HtmlSanitizer($config))->sanitize($storedHtml);
echo app(SvityloAnatomy::class)->html($clean); // 

use Authorod\SvityloAnatomy\Livewire\InteractsWithAnatomy;
use Livewire\Attributes\On;

class Lesson extends Component
{
    use InteractsWithAnatomy;

    public ?string $selected = null;

    public function showHeart(): void
    {
        // Only the heart, selected; then the first level of its surroundings at 78% transparency.
        $this->anatomy('atlas')->showStructure('cardiovascular.heart')->showSurroundings('cardiovascular.heart');
    }

    public function widerView(): void
    {
        $this->anatomy('atlas')->setSurroundingsLevel(2)->setTransparency(0.5);
    }

    #[On('anatomy-select')]
    public function onSelect(?string $primary = null, ?string $atlas = null): void
    {
        $this->selected = $primary;
    }
}