How to install laravel in window ?

Here are provide some step to install laravel in windows.

Step : 1  Download laravel latest package from given link : http://laravel.com/docs/installation

Step : 2  After that copy past in your local server directory.

You have a wamp server  then  paste in www  folder.
Or
xampp server  user paste latest laravel package in htdocs folder.

Step : 3  Install Composer-Setup in your PC for command line setup .   Download Composer-Setup  form given link  https://getcomposer.org/download/

Step :4  Go to Command line and type given command line code
   c:/xampp/htdocs>composer create-project laravel/laravel c:/xampp/htdocs/laravel-project name

Step  :  5 Press Enter key after that laravel installing  process running and it install all required detail for laravel project.

Step : 6 Goto your favorite browse type  here : http://localhost/laravel-test/public/

Here laravel-test is your laravel-project name

Step : 7 Your laravel installation process is complete.

Step : 8 After that you can  create your controller and etc …..

Step : 9 Enjoy the laravel framework .

PHP Laravel  framework  reference link :

http://laravel.com/docs

http://three.laravel.com/docs/home

How to install ZendFramework2 Application ?

Getting started: A ZendFramework2 skeleton application

Build your application, we will start with the ZendSkeletonApplication available on github. Use Composer (http://getcomposer.org) to create a new project from scratch with Zend Framework:
Use These code

 
php composer.phar create-project --repository-url="https://packages.zendframework.com" -s dev zendframework/skeleton-application path/to/install

Another way to install the ZendSkeletonApplication is to use github. Go to https://github.com/zendframework/ZendSkeletonApplication and click the “Zip” button. This will download a file with a name like ZendSkeletonApplication-master.zip or similar.

Unzip this file into the directory where you keep all your vhosts and rename the resultant directory to zf2-tutorial.

ZendSkeletonApplication is set up to use Composer (http://getcomposer.org) to resolve its dependencies. In this case, the dependency is Zend Framework 2 itself.

1. If you have already install composer then setup your application with zf2 using composer
2. Otherwise Download composer and install composer then after setup your zf2 application

Using these command:
Go To your ZendSkeletonApplication directory :

c:\wamp\www\ZendSkeletonApplication&gt;php composer.phar self-update<

c:\wamp\www\ZendSkeletonApplication&gt;php composer.phar install

Ready to use your ZendSkeletonApplication application

How to use sql command in yii?

Hi Guys

I have provide you sql command in yii .thses sql command execute in yii framework .

Insert row in databse table using yii framework here are following type code :

$result = Yii::app()->db->createCommand("INSERT INTO `bakupemail` (`id` ,`user_id` ,`send` ,`form`)
VALUES ('44' , '44', 'hari', 'maliya')");
$res    = $result->query();

Update row in databse table using yii framework here are following type code :

$result = Yii::app()->db->createCommand("UPDATE `bakupemail` SET `user_id` = '194',`send` = 'test1',`form` = 'test2' WHERE `id` =3");
$res    = $result->query();

Select all  databse table using yii framework here are following type code :

>
$result = Yii::app()->db->createCommand("select * from bakupemail");
$res    = $result->query();
echo "Second databse table data<br>";
foreach($res as $item)
{
echo $item['send']."<br>";
}

Thanks All

Multiple-database support in Yii

Hi Guys

I have 2 database like test1 and test2.

You can easily use multiple database in yii ,using some instruction these are following here.

step-1: You go on protected/config/main.php and find these line :

'db'=>array(
 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', ),

step-2: Set your multiple database in here like these type:

/*'db'=>array(
 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
 ),*/
 // uncomment the following to use a MySQL database

'db'=>array(
 'connectionString' => 'mysql:host=localhost;dbname=test1',
 'emulatePrepare' => true,
 'username' => 'root',
 'password' => '',
 'charset' => 'utf8',
 //'tablePrefix' => 'tbl_',
 'class'=>'CDbConnection'
 ),
 'db2'=>array(
 'connectionString' => 'mysql:host=localhost;dbname=test2',
 'emulatePrepare' => true,
 'username' => 'root',
 'password' => '',
 'charset' => 'utf8',
 //'tablePrefix' => 'tbl_',
 'class' => 'CDbConnection'
 ),

step-4: You can access all database table in your yii application.

step-5: If you want to create curd with gii models then test1 database table listed in your gii model class, but test2 database table not listed in your gii.

step-6: You usually access test2 database using yii sql command like thse type:

$result = Yii::app()->db2->createCommand("select * from bakupemail");
 $res = $result->queryAll();
 echo "<br>";
 print_r($res);
 echo "<br>";

Thanks All

How to Access login user role based yii application ?

Hi Guys
We have 3 users like these type . 1. Admin 2. staff 3. Client.
You Can easily set a role based access page and action for lo-gin users.
Firstly you create a one of column in your database user table like role and set a every user role in your user table.

Step -1 You got to protected/component/UserIdentity.php , and set Following type code.

public function authenticate()
{
   $user = User::model()->findByAttributes(array('email'=>$this->username));
	if ($user===null)
    { // No user found!
      $this->errorCode=self::ERROR_USERNAME_INVALID;
     } else if ($user->password !== ($this->password) )
              { // Invalid password!
                  $this->errorCode=self::ERROR_PASSWORD_INVALID;
               } else { // Okay!
                       $this->errorCode=self::ERROR_NONE;
                       // Store the role in a session:
                       $this->setState('role', $user->role);
                       $this->_id = $user->id;
                      }
                return !$this->errorCode;
 }

Step- 2 Then after you can set these code in YourController.php


public function accessRules()
{
     if( Yii::app()->user->getState('role') =="admin")
      {
	     $arr =array('index','calendar','contact','staff','service');   /* give all access to admin */
	  }
	 if( Yii::app()->user->getState('role') =="staff")
      {
	  	$arr =array('index','staff','contact','calendar');   /* give all access to staff*/
	  }
	  else
      {
	  	$arr = array('');    /*  no access to other user */
	  }
     return array(array('allow',
	 					'actions'=>$arr,
						'users'=>array('@'),),
                 array('deny',
				 	   'users'=>array('*'),),
                );
}

Step -3 Now you can access your application with role based lo-gin user .

Amazon-Setup-Process

CREATE INSTACE IN AWS AMAZON

1. Go  on “http://aws.amazon.com/”.

1

2. Click on My Account / Console and select AWS Management Console.

3. Login Your username and passowrd Otherwise create new account .

2

4. Select EC2 Virtual Server in the Cloud .

3

5. Click on Launch Instance.

4

6.Select Classic Wizard then click on continue Button

5

7. Select Ubuntu server 12.04.LTS Then click on Select Button .

6

8.Click on Continue 4 time Continue Button.

7

End of Image

10

9. If You have key pair then select existing key pair otherwise Select Create a new key pair.

26

10. Write your key name “test” and download your key pair .

11. Click on Create & Download yor key pair link.

27

12. Select Your groups and create new group

13

13. Set your security rule using inbound rules and set your http port (80) .

14

14. Click on Continue Button  and after then click on launch button

15

15. Your ubuntu instance hase been created.

16

16. Set Your instance name.

17

17. Public DNS: is your http:domain name and your ubuntu@domain name

18

18. Create your ssh private key using PUTTYGEN.

19. Select your  test.pem file and save test.ppk

20. Login your instance machine using ubuntu@domain_name and

select ssh->auth or click on browse button and selct your test.ppk file

and click on open button

21

21. Install all required s/w .

22

22. chers…………..

23

Thanks

hari maliya