PHP MVC

PHP MVC

Composer

Composer on Cygwin

  1. $mkdir /home/birca/bin/composer
  2. $php -r "readfile('https://getcomposer.org/installer');" | php
  3. put composer.phar in this (above) dir
  4. create alias in .bashrc - alias composer='/home/birca/bin/composer/composer.phar'
  5. $composer global require "laravel/installer=~1.1"
  6. Make sure to place the ~/.composer/vendor/bin directory in your PATH

Zend Framework 2

Laravel

  1. goto HTDOCS (/cygdrive/c/cygwin64/srv/www/htdocs)
  2. composer create-project laravel/laravel laravel (will install laravel and create app laravel)
  3. routes.php is in /app/Http
  4. views go in /resources/views
  5. models go in /app/ e.g. User.php

Laravel Common problems

Class 'User' not found routes.php

  1. In routes.php ensure App\ befreo model name
  2. In composer.json ensure User.php is explicity included
Route::get('users', function()
{
     ## return View::make('users');
        $users = App\User::all();

        return View::make('users')->with('users', $users);
});
"classmap": [
                        "database",
                        "app/User.php"
                ],
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License