Install script using Laravel models, possible? [duplicate] - php

Is it possible to use Eloquent without Laravel or does somebody knows a equally easy to use ORM?

Yes you can. A while ago Dan Horrigan released a package called Capsule for Laravel 4 which allowed Eloquent to be used independently and with minimal setup. The package itself has been merged with the L4 core so you no longer need to use the package.
If you refer to the illuminate/database repository there is a nice little introduction on using Eloquent without the framework.
Here is a small excerpt of getting it up and running.
$capsule = new Illuminate\Database\Capsule($config);
$capsule->bootEloquent();
$capsule->connection()->table('users')->where('id', 1)->first();
Update
Dan Horrigan has since removed his Capsule implementation as it is now built directly into Eloquent. Refer to the above illuminate/database link for more details on how to use Capsule.

Check out https://github.com/Luracast/Laravel-Database it provides full eloquent support including artisan migrations and more for the latest Laravel 8.* components.
It uses capsule and lazy loads the components when they are used.
Disclosure: I'm the author of this repository

In Laravel 4.*, Eloquent is automatically independent because it's shipped with Dan Horrigan's Capsule. You don't need to download any extras. For a how to please visit: https://github.com/illuminate/database/blob/master/README.md

Related

how to use laravel Route system in another php projects?

i am creating a php project for myself and it is not on laravel, i install illuminate/database package on my project for using elequent and its work perfectly.
now i want to use laravel routing system in my project but can not find any Instructions for this
is there any way to use that?
yes you can use all illuminate component like router in your project.you should see : https://github.com/mattstauffer/Torch Torch is a project to provide instructions and examples for using Illuminate components as standalone components in non-Laravel applications.
I would recommend you do too if you like that. https://symfony.com/doc/current/routing.html#creating-routes
If you would like another package that works much similar to Laravel routing, take a look at Klein.

is Collection a Laravel instance or PHP instance?

is collection a laravel instance or PHP instance.
I always hear people say a Eloquent return a laravel collection so I want clearance on this
The Collection class in Laravel is a part of the Laravel framework. Therefore, if you attempt to use the Collection class in a pure PHP project (without the use of Laravel) you will not be able to use the Collection class by default.
You can make use of the Collection class without using all of Laravel. You'll see it's part of the Illuminate/Support components on github. https://github.com/illuminate
There are also composer packages that will install the Collection class for you all on it's own. https://github.com/tightenco/collect. So, I don't think it's correct to say it's a "Laravel Instance", but unless you install it on your project, you won't have access to the class without Laravel.
Laravel makes use of a lot of components that Laravel did not write on it's own. Symphony, is a major example of this.

How to add method to vendor class?

Could you tell me guys how to add a new method to vendor class for example for:
vendor/illuminate/html/FormBuilder.php
Whats the proper way to extend my laravel classes? I guess craeting new class somewhere in app folder?
The best way to extend the actual Laravel packages is to create your own package that require and extends (in your case) the Illuminate FormBuilder object. First check out the official docs here.
Be aware that the Form Builder is deprecated and no longer supported in the last Laravel releases. You can use the LaravelCollective Package instead.
So, let's recap... To achieve your goal you should:
Create your own package that requires the LaravelCollective component
Extend the LaravelCollective FormBuilder adding your own methods
Register your package into Laravel Container binding your own Service Container

Does Laravel support scaffolding?

Yii framework has a very good module that provides scaffolding (generates CRUD with forms - responsive) known as GII. It generates the basic search grid, insert, update and delete for a database entity. It really speeds up the develop.
I am planning to develop another product in Laravel, I didn't come across any scaffolding tutorial.
Do we have any scaffolding module in Laravel 5.X ?
Try The Scaffold-Interface
generate your model,view,controller + one to many relationship just in few clicks.
You can used Ping pong module generator this is really helpfull for me.
http://sky.pingpong-labs.com/docs/2.1/modules
just try it i hope this is helpfull for you.
it's generate full module like yii2 generator Grid,insert,update,delete,etc.....
Yes It does. They have Generators for the same purpose. As for example, Laravel 4 Generator in github should do it for you. Not sure if as effective as Gii though. You should do some experiment on this.
Edit: Laravel 5 Generator in github.
Laravel is so flexible .. Lots of packages out there especially for laravel . surely you could get a decent package .. You could refer this FYI laravel package for curd

Laravel 5.x Forms best practice

as described at the Laravel documentation, the official form builder is not supported anymore since Laravel 5.0. I need to build a multi page form in my Laravel project. What is the best practice how to do that? Because it's a new project, I don't think it's best practice to use the class from Laravel Collective.
Laravel doesn't come with all packages that are available in the world, doesn't mean you shouldn't freely use whatever package that you need and does the job.
So, unless you are ready to re-invent the wheel and re-implement the forms package then use the already existing and well tested package from Laravel Collective.

Categories