Table of Contents generated with DocToc
Administration panel for managing Software Licences of clients
Why it is in Laravel, read section below Why Laravel
To do anything user must be logged.
- Login page
- Register page
- Dashboard
- Logout
- Companies (List, Add, Delete, Show Details)
- Prepare Master Layout for Localization
- Prepare Companies part layout for Localization
- Reset password
- create db
- change .env
- composer install
- php artisan key:generate
- php artisan migrate
- set cron job for scheduler
Read section below While in Dev.
- Add Auth routes
- Add views: register, login
$php artisan migrate
-
- test is it working: Register new user "John Doe, ...."
- Add missing
home
- Instead of
home
setdashboard
to be first page after login - Add functional tests: Register, LoginLogout, Logout redirect.
If user forget password he can make reset request by filling form with email,
and email with unique token will be sent to his email address.
On clicking on email with token url he is able to fill new password in form,
and it will be directly logged to Admin panel and redirected to /companies/
.
http://taylorotwell.com/on-community/
- This week, Laravel became the most popular PHP project on Github - Jan 5th 2014.
We want to develop company and ourselves with the latest technology used and with community offered - Best practices.
Laravel provides nice already built structure for every developer to be on same page. We don't have to discover hot-water, nor America :)
Authentication, Sessions, Testing, ORM, Queue, Emailer, ... all are already there!
Laravel is proclaimed to be RAD tool. - Build fast, refactor later.
Has Database migrations and seeders out of the box
- track DB changes in VCS (git)!
- don't have to use anything else but php to develop app.
For fast RAD start with Laravel's Eloquent ORM that implements Active Record pattern and later you can use Doctrine 2 that implements Data Mapper pattern.
Blade template engine is nice and clean (~twig).
By default it will return JSON response.
- ZF2 - waiting for ZF3
- Symphony 2
- CakePhp - no migration out of the box
Install tools:
- npm install
Awesome feature is to use Elixir to run PhpUnit on every file save!
Add to gulpfile.js inside :
elixir(function(mix) {
// other actions
mix.phpUnit();
});
Just from terminal run:
$ gulp tdd
Check this page when you could not find what you are looking for in Laravel Test Laracast/Integrated.
On how to use config
, pagination
and Back Button
read L5 Beauty - 10 min blog.
And watch Laracast What's new in L5.1.
To test 403 - Unauthorised
you have to use get
with assertResponseStatus(403)
instead of visit
because visit
-ing unauthorised page will throw exception!
Example: As viewer visit company edit page /company/123/edit
$this->actingAs($unautorisedUser)
->get('/forbiddenPage')
->assertResponseStatus(403);
Other solution is to wrap visit in try
and assert match exception status code in catch
with PHPUnit.
try {
$this->actingAs($unautorisedUser)
->get('/forbiddenPage');
} catch (\Exception $e) {
$expectedResponseStatus = 403;
\PHPUnit_Framework_Assert::assertEquals($expectedResponseStatus, $e->getStatusCode());
}
Note:
assertResponseStatus()
should be called aftersee()
- it does not return fluent object. Laravel issue#11106
In production cron will every minute run this script:
php artisan schedule:run
we can also run this command to test it.
Laravel scheduled cron commands are definde in schedule
method of Kernel class in app/Console/Kernel.php
.
Tricky part is how to set all required to run and successfully pass all test on some remote machine.
Most of required steps are written in build.xml
- an Ant Build script.
- Add job to jenkins
- git repo:
- !remember the url used!, <- will be needed for hook
- set credentials (add new SSH user/pass)
- set remote (origin, in my case p1 or demo),
- set branch (master or develop)
- Trigger: SCM, empty params <- should be empty, triggered by hook
- Build:
4.1. shell script:
php -r copy('.env.example', '.env');
4.2. ant target:get.composer vendor
4.3. shell script: 4.3.1php artisan key:generate
4.3.2php artisan migrate
4.4. ant target:full-build-parallel
Test it you can run it from terminal on local dev or on remote machine, and result should be the same:
$ ant
or specific target only:
$ ant phpunit
On build server login with jenkins user, and login to mysql, and create new user 'homestead'.
mysql -u root -pPASSWORD
CREATE USER 'homestead'@'localhost' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON homestead.* TO 'homestead'@'localhost';
FLUSH PRIVILEGES;
CREATE DATABASE homestead;
This homestead
user and database schema will be used for testing and build on Jenkins CI.
Other solution, may be better and faster, for this problem is to instead of mysql use in memmory SqLite.
If some errors show up try with different version of elixir (eg. from ^4.0.0 change to ^3.0.0). And read messages carefully! Elixir requires:
- node
- python27 with Environment variable set on windows
- MSWindows SDK and some lib from it in PATH
Parts:
- Save new licence
- Send reminders
- Send approval email when new licence is saved