Handling quoted string passed to Blade::directive() in Laravel 5.3
<p>Given the custom blade directive:</p>

<pre><code>Blade::directive('svg', function ($expression) {
    return "&lt;?php echo public_path(\"img/{$expression}.svg\"); ?&gt;";
});
</code></pre>

<p>Called by:</p>

<pre><code>@svg('jason');
</code></pre>

<p>Yields an error due to the quotes appearing in the resulting PHP:</p>

<pre><code>&lt;?php echo public_path("img/'jason'.svg"); ?&gt;
</code></pre>

<p>I feel like the wrapping quotes should have been removed for me… Do I need to remove them myself? Is there a better way?</p>