Level 3
This was an error with the class name not being capitalized
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a simple button component that I am trying to provide some colour logic with a fallback when none is provided.
<button type="button"
{{ $attributes->merge(['class' => "inline-flex ".($colour)] }}>
{{ $slot }}
</button>
class button extends Component
{
public $colour;
public function __construct($colour = null)
{
if (! $colour) {
$this->colour = 'blue';
} else {
$this->colour = $colour;
}
}
...
When passing no variable as below, we get an "Undefined variable" exception, on Vapor only.
<x-button>Save</x-button>
If we then pass in the colour attribute:
<x-button colour='blue'>Save</x-button>
We get the below html on Vapor (note the colour attribute being outputted as HTML)
<button type="button" class="inline-flex" colour="blue">
Save
</button>
vs. this on local/valet:
<button type="button" class="inline-flex blue">
Save
</button>
So local works as I would expect, but vapor fails with:
This was an error with the class name not being capitalized
Please or to participate in this conversation.