Laravel installed but confusion remains - laravel-4

I have ubuntu 14.04 and LAMPP is installed. I was learning Laravel 4, but get a lot of confusion on it's documentation, below I list few of issue.
How to install laravel?
what I did :
copy github repository into /opt/lampp/htdocs/larva and run composer install, Laravel is installed and I can access it with http://localhost/larva
What is homestead? is that another way to install laravel or this is additional thing?
What is artisan? if I use artisan then do we need to use homestead also?
what I did ( in terminal )
cd /opt/lampp/htdocs/larva
php artisan serve
it started the service and I can access laravel with htpp://localhost:8000 BUT if i close this terminal then URL is lost
and there is one other way is using vagrant? do we need to use vagrant if we installed it already?
one more thing is Nginx?
overall these vagrant, Nginx, Homestead, artisan,and composer methods create such a mess.
Please clear the clouds and please do not mention what is vagrant Nginx and all. I just want to know that do I need to do something with Homestead and vagrant if i have installed using git repository and composer way?
Thanks

Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.
Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.
When you close the terminal, you are stopping the service on port 8000. You always can create a virtual host, and point its root to your larval installation /public directory
you dont have to use vagrant to run laravel. Vagrant is just your 'bridge' to Virtual Mashine.
If you installed LAravel via composer and you got it work on localhost:8000 then you dont need neither homestead or vagrant

Related

localhost is unable to load application centos server

Trying to fire up a Laravel api and Nuxt app on the actual server by running
lets say server IP is - 10.66.22.41
npm run dev
php artisan serve --port=8001
This obviously worked on my local environment but since this is in the actual server and I am not too familiar with Centos, is there anything I should be doing different?
When I run npm run serve I get http://localhost:3001/
When I run php artisan serve --port=8001 i get http://127.0.0.1:8001
dumb question:
How should I be accessing this on the browser?
for Nuxt, added your script in package.json
"scripts": {
"dev:host": "nuxt --host 'IP-Address' --port 3001",
}
Run:
dev:host": "nuxt --host 'IP-Address' --port 3001
For Laravel:
php artisan serve --host=IP-Address --port=8001
Quick point though, What Khali should be the best practive but if you want to test or whatever you need to do , this is it.
Well, the artisan serve command, will keep the server running until you close the console, which will terminate the service! It is not an ideal setup... I would recommend that you install a webserver of some sort, and install laravel properly via composer. We cannot see how you installed NPM, or if you installed Apache? etc..
I would recommend to install centos webpanel for a starter:
http://centos-webpanel.com/
Then install composer https://linuxize.com/post/how-to-install-and-use-composer-on-centos-7/
Then install laravel using: https://laravel.com/docs/8.x/installation#installing-laravel
This is your best way to manage and run laravel on centos properly (for beginners), if you have the money for it, you should buy CPanel (https://cpanel.net/pricing/) instead of Centos WebPanel, as it offers more flexibility and features.
Good luck!

Should I use homestead for an exact Laravel replication?

My client is running Laravel 5.2 and PHP version 5.6 (all obviously several years old).
I tried to clone the git into Valet with relative success in that the application ran but a bunch of pages threw errors which I am certain is due to me running the latest version of PHP.
So, my question is it better to directly clone the project on Homestead?
Does Homestead offer a more "native environment" for a situation like I am in?
you should try to use an environment that is the closest possible to production.
If your customer uses apache, try xampp. Else adapt to his environment and PHP version, so you can concentrate on code production instead of keep the solution working on more than one environment.
One year later, I came across with the exact same problem; php 5.6.31 and Laravel 5.2.
I managed to simulate the environment with homestead 6, following these steps:
copy the project files to a new folder
Unzip php 5.6 to my local pc (remove php7)
run: composer update (must run with php 5.6 on local pc)
run: composer require laravel/homestead:~6.6.0
run: vendor\\bin\\homestead make
edit Homestead.yml as needed (.ssh path, add php: "5.6" one line below the site sync)
run: vagrant up
run: vagrant ssh
make appropriate changes (google them) according to problems faced on homestead.test (edit xdebug for 502 BAD GATEWAY, edit my.cnf for adding utf8, etc)

Homestead and Laravel basis understanding

I have some questions about the basis understanding about homestead and laravel.
I have set up my homestead with this guide: https://laravel.com/docs/5.2/homestead and it works ok.
1) But when I vagrant ssh into my box, I can call composer, but I can't call laravel or php artisan. Have I done something wrong/misunderstod something?
2) Do I need to install php and laravel locally, can't I just run it on my VM like i do now?
To call php artisan commands (after you ran vagrant ssh command) you need to have installed Laravel project and you need to be in project's root folder:
cd my-laravel-project
php artisan

Is Laravel/Homestead can be used on other PHP frameworks?

I am not yet used Laravel and I am just curios if the Homestead can be used on other PHP frameworks like CodeIgniter?
Homestead runs on Ubuntu within a Virtual Machine. It comes with the following software installed:
Ubuntu 14.04
Git
PHP 7.0
HHVM
Nginx
MySQL
Sqlite3
Postgres
Composer
Node (With PM2, Bower, Grunt, and Gulp)
Redis
Memcached
Beanstalkd
Pretty much anything a webserver needs to run any kind of PHP framework. If there's something missing for the framework you're using, you can install it.
You can of course use it for any php related project. But be careful when configuring the Homestead.yaml file to correctly set the path to your projects.
sites:
- map: laravel.app
to: /home/vagrant/Code/laravel/public
- map: codeigniter.api
to: /home/vagrant/Code/codeigniter
You can also setup multiple databases if you need to.
Simply don't forget to run bash init.sh and vagrant provision each time you modify the config file.

What is the benefit of using vagrant in Laravel?

What is the benefit of using Vagrant (via homestead) instead of using WAMP server on Microsoft Windows?
I found that configuring homestead and vagrant is harder than installing WAMP. Isn't it?
Laravel Vagrant is a homestead for development environment.
Its easy to install server requirements and including many dependencies in out command.
Ubuntu 14.04
PHP 5.6
HHVM
Nginx
MySQL
Postgres
Node (With Bower, Grunt, and Gulp)
Redis
Memcached
Beanstalkd
Laravel Envoy
Fabric + HipChat Extension
You don't needs to spend your time for configuring web server locally for this.
I think in windows better is Wamp, but in case of Ububtu and Mac, the Vagrant (Homestead) is better than others...

Resources