This seems to be a file in your own app? App\Libraries\CommonMark\Extension\Embeds\Services\CustomYouTube
Can you show the code?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
My config working well but I can't cache my markdown.php
'commonmark_options' => [
'embeds' => [
new CustomYouTube(),
],
...
...
],
When I set markdown.php config like this I get this error:
$ php artisan config:cache
Configuration cache cleared!
LogicException
Your configuration files are not serializable.
at C:\Users\FIRAT\WebstormProjects\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigCacheCommand.php:80
76▕ require $configPath;
77▕ } catch (Throwable $e) {
78▕ $this->files->delete($configPath);
79▕
➜ 80▕ throw new LogicException('Your configuration files are not serializable.', 0, $e);
81▕ }
82▕
83▕ $this->info('Configuration cached successfully!');
84▕ }
1 C:\Users\FIRAT\WebstormProjects\project\bootstrap\cache\config.php:616
Error::("Call to undefined method Ueberdosis\CommonMark\Services\CustomYouTube::__set_state()")
2 C:\Users\FIRAT\WebstormProjects\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigCacheCommand.php:76
require()
config/markdown.php
<?php
use App\Libraries\CommonMark\Extension\Embeds\Services\CustomYouTube;
use BenFiratKaya\CommonMarkExtension\LinkTextViewerExtension;
use BenFiratKaya\CommonMarkExtension\UnderlineExtension;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
use League\CommonMark\Extension\ExternalLink\ExternalLinkExtension;
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
use SimonVomEyser\CommonMarkExtension\LazyImageExtension;
use Ueberdosis\CommonMark\EmbedExtension;
return [
'code_highlighting' => [
/*
* To highlight code, we'll use Shiki under the hood. Make sure it's installed.
*
* More info: https://spatie.be/docs/laravel-markdown/v1/installation-setup
*/
'enabled' => true,
/*
* The name of or path to a Shiki theme
*
* More info: https://github.com/shikijs/shiki/blob/master/docs/themes.md
*/
'theme' => 'one-dark-pro',
],
/*
* When enabled, anchor links will be added to all titles
*/
'add_anchors_to_headings' => true,
/*
* These options will be passed to the league/commonmark package which is
* used under the hood to render markdown.
*
* More info: https://spatie.be/docs/laravel-markdown/v1/using-the-blade-component/passing-options-to-commonmark
*/
'commonmark_options' => [
'renderer' => [
'block_separator' => "\n",
'inner_separator' => "\n",
'soft_break' => "\n",
],
'commonmark' => [
'enable_em' => true,
'enable_strong' => true,
'use_asterisk' => true,
'use_underscore' => true,
'unordered_list_markers' => ['-', '*', '+'],
],
'external_link' => [
'internal_hosts' => '/(^|\.)voxelon\.net$/',
'open_in_new_window' => true,
'html_class' => 'external-link',
'nofollow' => 'external',
'noopener' => 'external',
'noreferrer' => 'external',
],
'link_text_viewer' => [
'internal_hosts' => '/(^|\.)voxelon\.net$/',
'link_type' => 'all',
],
'embeds' => [
new CustomYouTube('100%', '300', true),
],
'html_input' => 'escape',
'allow_unsafe_links' => false,
'max_nesting_level' => 3,
],
/*
* Rendering markdown to HTML can be resource intensive. By default
* we'll cache the results.
*
* You can specify the name of a cache store here. When set to `null`
* the default cache store will be used. If you do not want to use
* caching set this value to `false`.
*/
'cache_store' => null,
/*
* This class will convert markdown to HTML
*
* You can change this to a class of your own to greatly
* customize the rendering process
*
* More info: https://spatie.be/docs/laravel-markdown/v1/advanced-usage/customizing-the-rendering-process
*/
'renderer_class' => Spatie\LaravelMarkdown\MarkdownRenderer::class,
/*
* These extensions should be added to the markdown environment. A valid
* extension implements League\CommonMark\Extension\ExtensionInterface
*
* More info: https://commonmark.thephpleague.com/2.1/extensions/overview/
*/
'extensions' => [
new ExternalLinkExtension,
new AutolinkExtension,
new LinkTextViewerExtension,
new LazyImageExtension,
new EmbedExtension,
new StrikethroughExtension,
new UnderlineExtension
],
/*
* These block renderers should be added to the markdown environment. A valid
* renderer implements League\CommonMark\Renderer\NodeRendererInterface;
*
* More info: https://commonmark.thephpleague.com/2.1/customization/rendering/
*/
'block_renderers' => [
// ['class' => FencedCode::class, 'renderer' => new MyCustomCodeRenderer(), 'priority' => 0]
],
/*
* These inline renderers should be added to the markdown environment. A valid
* renderer implements League\CommonMark\Renderer\NodeRendererInterface;
*
* More info: https://commonmark.thephpleague.com/2.1/customization/rendering/
*/
'inline_renderers' => [
// ['class' => FencedCode::class, 'renderer' => new MyCustomCodeRenderer(), 'priority' => 0]
],
];
How can I fix this?
Anyways. According to the error you need to add this to you class https://www.php.net/manual/en/language.oop5.magic.php#object.set-state
Please or to participate in this conversation.