Download the PHP package wallacemaxters/laravel-navalha without Composer
On this page you can find all versions of the php package wallacemaxters/laravel-navalha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wallacemaxters/laravel-navalha
More information about wallacemaxters/laravel-navalha
Files in wallacemaxters/laravel-navalha
Package laravel-navalha
Short Description A small library to transform your laravel in alpinejs template
License MIT
Informations about the package laravel-navalha
Navalha
🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷
Navalha (is a joke with "Razor" name in portuguese) is a small framework written for Laravel, which allows binding of Laravel data on the server-side to AlpineJS variables.
How to Install
Run the follow command to install Navalha.
And publish assets
Now, your need to add @navalhaStyles
and @navalhaScripts
in the <head>
tag of your template.
Generate a Component
This command will generate resources/views/navalha/products.blade.php
view and app/Navalha/Products.php
class.
To render the component, your need to writen the follow code:
Navalha component example
In follow example, we will paginate the data of Product
Eloquent model in server-side component. In the view, the values will be convert to AlpineJs variables.
See:
Code of resources/views/navalha/products.blade.php
:
Code of welcome.blade.php
:
Code of route:
Navalha special frontend variables and methods
Variable | Type | Description |
---|---|---|
$n.$busy(String|undefined) | Function | Indicates that an specifiy or any method is called from the server. |
$n.$errors(String|undefined) | Function | Get an or many validation errors. |
$n.[method]() | Function | Call a public method of component in Laravel side. |
$n | Object | This a special object from Navalha that allows make methods call like $call(). |
Handle Server Errors
Your can detect errors on call Navalha method with navalha-errors
event.
Example: