5/30/2016 Deciding to move to Laravel, partially at Michanel Hanes recommendation, also because I read that CakePhp is now old and not being supported much.
Installed Laravel 5.2.34
5/30/2016 Setting up workstation. Installed Composer to workstation, by opening XAMPP console, and running these lines:
(Check this location because the installation lines below will change: https://getcomposer.org/download/)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '070854512ef404f16bac87071a6db9fd9721da1684cd4589b1196c3faf71b9a2682e2311b36a5079825e155ac7ce150d') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
This worked. I can run composer with this:
php composer.phar
Now I can install laravel:
php composer.phar global require "laravel/installer"
It installed into c:\Users\dan\AppData\Roaming\Composer\Vender\bin
laravel new cantata3
BAD: It created a partially complete (missing vendor directory) project cantata3 under c:\Users\dan\AppData\Roaming\Composer\Vender\bin. Noticed when it ran it complained about missing the command “composer”. So I reran again with this command instead:
Using the XAMPP shell tool, ran this:
php composer.phar create-project --prefer-dist laravel/laravel cantata3
Which appears to have obtained laraval again, and also created a better version of cantata3.
In EclipsePHP, created new PHP project “cantata3”, then copied generated content from the laravel step into the Eclipse canata3 directory.
Running Artisan
Noticed that there is an “artisan” file at the root of the project created by the steps above. The Laravel docs show commands like php artisan list but these need to be run from the root of the project.
In the Shell of XAMPP, do this to verify artisan commands:
cd c:\Users\dan\workspacePHP\cantata3 php artisan list
To create the Users table, ran this:
php artisan migrate:refresh
This ran the class under database/migrations
php artisan make:model FileMeta -m
You create the migration file, edit it, and run with
php artisan migrate
This will create a PHP class in the Models directory.
Listened to “Website Builder” Laravel 5 tutorial. He made it very clear, and seems to be using Laravel 5.2 Also listened to others regarding Laravel 5.0, but it appears that the “best practices” may have changed>
https://www.youtube.com/watch?v=66LpDiStY5w
Max (the presenter) recommended http://c9.io as a development environment provider. From the notes above, I set it up on my PC. Assumedly it works OK for either. 6/16/2016
Why use VirtualBox-Vagrant? Explanation: https://www.sitepoint.com/re-introducing-vagrant-right-way-start-php/
Following the instructions here: https://laravel.com/docs/5.2/homestead#installation-and-setup
vagrant box add laravel/homestead (8/12/2016 4:43 p.m.)cd ~ git clone https://github.com/laravel/homestead.git Homestead
then
cd ~/Homestead (probably actually cd \Users\dan\Homestead) ./init.sh
There are two important areas, one is the \Users\dan\Homestead directory, the other is inside of the \Users\dan\.homestead directory (containing Homestead.yaml).
The idea here is that there is a virtual machine with PHP, MySQL, and Laravel running. But we access it with virtual directories, not directly. There is also a way to virtually SSH to the running box.
To start Vagrant:
cd \Users\dan\Homestead vagrant up
The command vagrant ssh didn't work, so tried putty. There was a recommended key at this location:
Private key: C:/Users/dan/Homestead/.vagrant/machines/default/virtualbox/private_key
But it doesn't work with putty. Instead, logged in with vagrant:vagrant then changed password to a usual value.
Helped get the folders setting correct:
http://stackoverflow.com/questions/29143680/understanding-the-homestead-yaml-file-in-laravel
8/29/2016
The file Homestead.yaml contains this part, which exposes “public” with a NGinx web server. I have to map “cantata3” to 192.168.10.10. 9/22/2016
I added this to C:\Windows\System32\drivers\etc:
192.168.10.10 cantata3
I was able to ping cantata3 and get a response. However, visiting cantata3/test.htm gave No input file specified. - not sure why 9/22/2016
Found these instructions (here: https://laravel.com/docs/5.3/homestead), which fixed the problem:
If you change the sites property after provisioning the Homestead box, you should re-run
vagrant reload --provision
to update the Nginx configuration on the virtual machine.