LaravelPackages.net
Acme Inc.
Toggle sidebar
laraform/laraform-laravel

Laraform Community Edition (Laravel)

37.235
14
1.2.1
About laraform/laraform-laravel

laraform/laraform-laravel is a Laravel package for laraform community edition (laravel). It currently has 14 GitHub stars and 37.235 downloads on Packagist (latest version 1.2.1). Install it with composer require laraform/laraform-laravel. Discover more Laravel packages by laraform or browse all Laravel packages to compare alternatives.

Last updated

Laraform Community Edition (Laravel)

This repository contains the Laravel package of Laraform's Community Edition.

Check out laraform/laraform repo or Documentation for more details.

Installation

composer require laraform/laraform-laravel

Usage

// app/Forms/MyFirstForm.php

<?php

namespace App\Forms;

use Laraform;

class MyFirstForm extends Laraform
{
  public $schema = [
    'hello_world' => [
      'type' => 'text',
      'label' => 'Hello',
      'default' => 'World'
    ]
  ];
}

Pass the form to the view:

// routes/web.php

Route::get('/', function () {
  return view('welcome', [
    'form' => app('App\Forms\MyFirstForm')
  ]);
});

Render:

<!-- resources/views/welcome.blade.php --->

<html>
  <head>
    <!-- ... --->
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link rel="stylesheet" type="text/css" href="/css/app.css">
  </head>
  <body>
    <div id="app">
      {!! $form->render() !!}
    </div>

    <script src="https://raw.githubusercontent.com/laraform/laraform-laravel/refs/heads/main/js/app.js"></script>
  </body>
</html>

Please note that you need the Larafrom Vue package in order to make this work.

Star History Chart