Writing JavaScript in PHP?!

preview_player
Показать описание
You might not like this, but you can write JavaScript without ever leaving PHP. Because Livewire is so tightly connected with AlpineJS, doing things like this just makes everything SO. MUCH. EASIER.

I like it. Even if you don't. 😁

Links:

Keep creating.

---

Рекомендации по теме
Комментарии
Автор

What! I didnt know this was possible. You should create a Laravel course!

pythonantole
Автор

first time i saw that you can dispatch events from js to php and from php to js i was blown away, and then i learned that u can just push js from your php and i was even more blown away

OS-Advertising
Автор

Great video. I don’t know that the PHP function returning JS would run client side. I still thought it would do a server request 😮 good to know!

Great video as always man 👏

Devdojo
Автор

Thanks! I use custom Filamentphp Form and Action a lot and I see this can be really helpful at some places.

fathularifkamarudin
Автор

Really help full, thank you for your efforts 🎉❤

development
Автор

As someone that really likes JS, I don't mind using it. But it is nice being able to use PHP run JS functions. Definitely would have been nice to have had in my last project.

thedude
Автор

I use this to create couple of helper methods in my Livewire components like the one to refresh the whole page and with $delay support.

public function refreshPage(int $delay = 0): void
{
{ window.location.reload(); }, %d);', $delay));
}

devhammed
Автор

JOSH! What are you using to fold up the Tailwind classes into those logos?!?!?! That's awesome!

fylzero
Автор

My first thought upon seeing the thumbnail and the title of this video and the only reason why I clicked on it: Why Seth Rogen talks about PHP and JavaScript?

Dziekan
Автор

I did not know this when my tailwind toggle switches were not updating realtime, so ended up using dispatch and wire.on functions on the client side to reset the switches which was a pain

devOnHoliday
Автор

Can you make a video about rich text editors in laravel and livewire?

alinuxist
Автор

Awesome. Is there any same helper in laravel controller ?

jjplays
Автор

So idk. Maybe at this point is better to use js instead? I think you have rebuild a js logic. Here why I'm really uncertain on wich stack I have to use.. Cheers

Richardritchie-wf
Автор

How to dispatch modal window in livewire 3 after submit form ? would you please make a viode for it ?

yacoublearn
Автор

I don't know about this one man.
We spent a good effort fighting JavaScript's transition to the server, but I think we should let it do it's thing freely on the client.

else we're just as guilty as the react/next.js people, the php way.

ajzack
Автор

As much as I love using Laravel and Adonisjs, I **hate** PHP, they don't even have a basic implementation of an LSP (something that neovim hobbyist can build in weeks)

skeletala
join shbcf.ru