Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I download Laravel for every project?

I created a project with Laravel and downloaded from git via this command:

git clone -b develop git://github.com/laravel/laravel.git

The file size was about 21MB,

I want to know should I download Laravel for every project with this command?

like image 389
MajAfy Avatar asked Feb 06 '14 20:02

MajAfy


People also ask

What is the best way to install Laravel?

Via Download. Once Composer is installed, download the 4.2 version of the Laravel framework and extract its contents into a directory on your server. Next, in the root of your Laravel application, run the php composer.phar install (or composer install ) command to install all of the framework's dependencies.

Do I need to install PHP for Laravel?

Installing PHP 7.3+Laravel 8 requires PHP 7.3+ or above so you need this version or the latest version of PHP installed on your system. The process is straightforward on most systems.

Do I need xampp for Laravel?

At first, you should install XAMPP on your computer. To install different versions of Laravel, the PHP version of your XAMPP program is very important. If you have a lower version of PHP, you should upgrade it. Laravel needs the Composer program to manage its extensions.

Why should we use Laravel?

The first and best advantage of using the Laravel framework is that it follows - Model, View, and Controller-based architectural pattern and it has an expressive beautiful syntax which makes it object-oriented. Laravel provides an out-of-the-box configuration for the Authentication and Authorization system.


2 Answers

What you have done is cloned the framework itself, which you should only do if you're going to fork and develop the Laravel core.

What you should do instead is use Composer to install your Laravel projects. You'll also be using Composer for other dependency-related actions in said projects (including autoload). This is the proper way of installing a fresh Laravel framework for developing a website:

composer create-project laravel/laravel --prefer-dist

http://laravel.com/docs/installation

Then, any future Laravel projects you create will be loaded from your Composer cache without needing to re-download.

The Composer package also sets up all your vendor-related .gitignore information and includes several other really useful management features. This is important, because you only want to keep your application-specific code under git version control, not the framework itself or any other dependencies. (Otherwise, your diffs and commits will get polluted with the dependencies' development changes.)

Once you've created a repository for your project, and installed Laravel with Composer, and created your first few commits (with some migrations, models, and controllers, for instance), cloning your project usually works something like this:

cd /clone-here
git clone /myproject # Location of current project
# /clone-here now has only the application-specific files from /myproject.  It is 
# still missing the framework itself and other dependencies.
composer install  # Composer now looks at the dependencies in 
                  # /clone-here/composer.json and installs them into /clone-here/vendor
                  # including the Laravel framework.
# Now the framework and other dependencies are good to go.
php artisan migrate # Laravel makes all your DB schemas from your migrations
php artisan db:seed # Seed your lovely new DB tables

It's really elegant and fun once you get used to it.

Edit: See Sheikh's answer to save some time in the Composer install process!

like image 127
Leng Avatar answered Oct 01 '22 17:10

Leng


Already Leng gave a nice answer.

Installing Laravel since version-4.1* via Laravel Installer is faster than composer

First, download the Laravel installer PHAR archive. For convenience, rename the file to laravel and move it to /usr/local/bin. Once installed, the simple laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog would create a directory named blog containing a fresh Laravel installation with all dependencies installed. This method of installation is much faster than installing via Composer.

like image 36
The Alpha Avatar answered Oct 01 '22 18:10

The Alpha