SlideShare a Scribd company logo
Building a site in 15 minutes
      With the Yii Framework
What is Yii?
• MVC Framework
   – Model, View, Controller
• PHP
• Built to be fast, secure and professional
   – Faster than Cake, Codeigniter, Zend1
• Lots of plumbing already in place
   – Build a site quickly, don’t reinvent the wheel
• Gii GUI for quickly creating application scaffolding
   – Web-based code generation
                                            1http://www.yiiframework.com/performance/
How do we start?
• Basic VM image provided – run with VirtualBox
   – Already set-up : CentOS 6, Nginx, PHP, MySQL, Yii
• Some initial personlisation
   – Login as root, (password yii)
   – Create a user
      • useradd -G wheel akelk
      • passwd akelk
      • visudo

      • Make sure wheel can run sudo
   – Login as yourself (using putty)
Creating our site with Yii
• Run yiic
   – Directory already in place, navigate to /var/www/html/yiisite
   – Initially we run using sudo as all files are owned by nginx
   – sudo ../../yii/framework/yiic webapp .

   – Then we’ll change ownership and give ourselves write
     permissions for easier development purposes
   – sudo chown -R nginx:wheel .; sudo chmod -R g+w .

• Now we’re ready to visit our site
   – Fire up your favourite browser
   – Visit the main Yii URL (e.g. http://192.168.0.107/)
   – Explore the site
Configuring our site
• Main config file is in protected/config/main.php
   – Set up access to the mysql database
      •    'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=iproperty',
            'emulatePrepare' => true,
            'username' => 'iproperty',
            'password' => 'iproperty',
            'charset' => 'utf8',
          ),

   – Enable the Gii GUI
      • 'modules'=>array(
          'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'iproperty',
            'ipFilters'=>array('127.0.0.1','::1','192.168.*'),
          ),
        ),
Create the scaffolding
• Naïve SQL schema
   –   CREATE TABLE `listing` (
         `id` int(11) NOT NULL AUTO_INCREMENT,
         `title` varchar(255) DEFAULT NULL,
         `description` text,
         `state` varchar(50) DEFAULT NULL,
         `area` varchar(50) DEFAULT NULL,
         `price` decimal(10,0) DEFAULT NULL,
         `status` char(1) DEFAULT NULL,
         `issale` tinyint(1) DEFAULT NULL,
         `isrent` tinyint(1) DEFAULT NULL,
         PRIMARY KEY (`id`)
       ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

• Fire up gii and login
   – http://192.168.0.107/index.php?r=gii
   – Password is iproperty
• Create model (named listing)
• Create CRUD (using Listing model and listing controller)
Try it out
• Add a new listing or two
   – Using the create action
• View the listings
   – Using the view action
• Manage listings
   – Using the manage action
• But no search?
   – Only accessible via manage when you’re logged in
   – Let’s create one!
Extending our site
• Create a search action
   – Very similar to admin
• Allow access to all
   – Edit the accessRules method
• Create a view to render it
   – Similar to admin but use a CLinkColumn for the grid display
   – array(
       'class'=>'CLinkColumn',
       'urlExpression'=>
       'Yii::app()->createUrl("listing/view",array("id"=>$data->id))',
     ),

   – Re-use _search.php from the admin action
Review
• For simple CRUD, all you need is a sensible database schema,
  ActiveRecord and Gii; relationships will help you navigate
  between objects.
• You can add new actions – remember to keep the controllers
  skinny, the models fat
• There’s loads of helper classes:
   –   HTTP Responses (including errors)
   –   Caching (File, MemCache, Opcode caching)
   –   Data structures (Maps, Iterators, Queues)
   –   Validators (String, URL, Number, Email, etc)
   –   Web widgets (grids, forms, inputs)
   –   Web services (SOAP, REST)
   –   I18n (Translating, Messages, Date formats, etc)
• Read the documentation

More Related Content

What's hot

Codeigniter
CodeigniterCodeigniter
Codeigniter
minhrau111
 
Yii2 by Peter Jack Kambey
Yii2 by Peter Jack KambeyYii2 by Peter Jack Kambey
Yii2 by Peter Jack Kambey
k4ndar
 
Php Frameworks
Php FrameworksPhp Frameworks
Php Frameworks
Ryan Davis
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniter
Pongsakorn U-chupala
 
Having fun with code igniter
Having fun with code igniterHaving fun with code igniter
Having fun with code igniter
Ahmad Arif
 
Codeigniter Introduction
Codeigniter IntroductionCodeigniter Introduction
Codeigniter Introduction
Ashfan Ahamed
 
Mainframe, the fast PHP framework
Mainframe, the fast PHP frameworkMainframe, the fast PHP framework
Mainframe, the fast PHP framework
bibakis
 
Codeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginnerCodeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginner
aminbd
 
Introduction to CodeIgniter
Introduction to CodeIgniterIntroduction to CodeIgniter
Introduction to CodeIgniter
Piti Suwannakom
 
PHP Indonesia Meetup - What's New in Yii2 and PHP5.5
PHP Indonesia Meetup - What's New in Yii2 and PHP5.5PHP Indonesia Meetup - What's New in Yii2 and PHP5.5
PHP Indonesia Meetup - What's New in Yii2 and PHP5.5
Petra Barus
 
Apache Syncope 2.0 Enduser UI
Apache Syncope 2.0 Enduser UIApache Syncope 2.0 Enduser UI
Apache Syncope 2.0 Enduser UI
Andrea Patricelli
 
Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2
Cassiano Surek
 
Scaling Yii2 Application
Scaling Yii2 ApplicationScaling Yii2 Application
Scaling Yii2 Application
Petra Barus
 
Identity in ASP.NET Core
Identity in ASP.NET CoreIdentity in ASP.NET Core
Identity in ASP.NET Core
ondrejbalas
 
PHP Framework Battle
PHP Framework BattlePHP Framework Battle
PHP Framework Battle
Achievers Tech
 
Panada: An Introduction by Iskandar Soesman
Panada: An Introduction by Iskandar SoesmanPanada: An Introduction by Iskandar Soesman
Panada: An Introduction by Iskandar Soesman
k4ndar
 
Build your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generatorBuild your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generator
Mohith Shrivastava
 
Asp.Net Identity
Asp.Net IdentityAsp.Net Identity
Asp.Net Identity
Marwa Ahmad
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
mbaric
 

What's hot (20)

Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Yii2 by Peter Jack Kambey
Yii2 by Peter Jack KambeyYii2 by Peter Jack Kambey
Yii2 by Peter Jack Kambey
 
Php Frameworks
Php FrameworksPhp Frameworks
Php Frameworks
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniter
 
Having fun with code igniter
Having fun with code igniterHaving fun with code igniter
Having fun with code igniter
 
Codeigniter Introduction
Codeigniter IntroductionCodeigniter Introduction
Codeigniter Introduction
 
Mainframe, the fast PHP framework
Mainframe, the fast PHP frameworkMainframe, the fast PHP framework
Mainframe, the fast PHP framework
 
Codeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginnerCodeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginner
 
Introduction to CodeIgniter
Introduction to CodeIgniterIntroduction to CodeIgniter
Introduction to CodeIgniter
 
PHP Indonesia Meetup - What's New in Yii2 and PHP5.5
PHP Indonesia Meetup - What's New in Yii2 and PHP5.5PHP Indonesia Meetup - What's New in Yii2 and PHP5.5
PHP Indonesia Meetup - What's New in Yii2 and PHP5.5
 
Apache Syncope 2.0 Enduser UI
Apache Syncope 2.0 Enduser UIApache Syncope 2.0 Enduser UI
Apache Syncope 2.0 Enduser UI
 
Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2
 
Scaling Yii2 Application
Scaling Yii2 ApplicationScaling Yii2 Application
Scaling Yii2 Application
 
Identity in ASP.NET Core
Identity in ASP.NET CoreIdentity in ASP.NET Core
Identity in ASP.NET Core
 
PHP Framework Battle
PHP Framework BattlePHP Framework Battle
PHP Framework Battle
 
Panada: An Introduction by Iskandar Soesman
Panada: An Introduction by Iskandar SoesmanPanada: An Introduction by Iskandar Soesman
Panada: An Introduction by Iskandar Soesman
 
Build your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generatorBuild your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generator
 
Asp.Net Identity
Asp.Net IdentityAsp.Net Identity
Asp.Net Identity
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
 

Viewers also liked

Yii Framework
Yii FrameworkYii Framework
Yii Framework
Jason Ragsdale
 
Yii framework
Yii frameworkYii framework
Yii framework
Leena Roja
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
Jason Ragsdale
 
Introduction to Yii & performance comparison with Drupal
Introduction to Yii & performance comparison with DrupalIntroduction to Yii & performance comparison with Drupal
Introduction to Yii & performance comparison with Drupal
cadet018
 
Introduce Yii
Introduce YiiIntroduce Yii
Introduce Yii
zakieh alizadeh
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
Chandra S Oemarjadi
 
Yii Training session-1
Yii Training session-1Yii Training session-1
Yii Training session-1
AkkiCredencys
 
FUTEX 2015 Programme gb
FUTEX 2015 Programme gbFUTEX 2015 Programme gb
FUTEX 2015 Programme gb
FUTEX CONVENTION
 
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's newYiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
Alexander Makarov
 
1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.
1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.
1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.
Bicol IT.org
 
PHP Unit Testing in Yii
PHP Unit Testing in YiiPHP Unit Testing in Yii
PHP Unit Testing in Yii
IlPeach
 
Introduction to YII framework
Introduction to YII frameworkIntroduction to YII framework
Introduction to YII framework
Naincy Gupta
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
Alexander Makarov
 
Yii php framework_honey
Yii php framework_honeyYii php framework_honey
Yii php framework_honey
Honeyson Joseph
 
Yii workshop
Yii workshopYii workshop
Yii workshop
Simone Gentili
 
Cancer de mama
Cancer de mamaCancer de mama
Cancer de mama
Lilian Lemus
 
Yii framework
Yii frameworkYii framework
Yii framework
Mohammed Saqib
 
Nram presentation 3
Nram presentation 3Nram presentation 3
Nram presentation 3
Prince Jairaj
 
Futex Scaling for Multi-core Systems
Futex Scaling for Multi-core SystemsFutex Scaling for Multi-core Systems
Futex Scaling for Multi-core Systems
Davidlohr Bueso
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
Mandy Suzanne
 

Viewers also liked (20)

Yii Framework
Yii FrameworkYii Framework
Yii Framework
 
Yii framework
Yii frameworkYii framework
Yii framework
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
Introduction to Yii & performance comparison with Drupal
Introduction to Yii & performance comparison with DrupalIntroduction to Yii & performance comparison with Drupal
Introduction to Yii & performance comparison with Drupal
 
Introduce Yii
Introduce YiiIntroduce Yii
Introduce Yii
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
Yii Training session-1
Yii Training session-1Yii Training session-1
Yii Training session-1
 
FUTEX 2015 Programme gb
FUTEX 2015 Programme gbFUTEX 2015 Programme gb
FUTEX 2015 Programme gb
 
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's newYiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
 
1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.
1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.
1ST TECH TALK: "Yii : The MVC framework" by Benedicto B. Balilo Jr.
 
PHP Unit Testing in Yii
PHP Unit Testing in YiiPHP Unit Testing in Yii
PHP Unit Testing in Yii
 
Introduction to YII framework
Introduction to YII frameworkIntroduction to YII framework
Introduction to YII framework
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
 
Yii php framework_honey
Yii php framework_honeyYii php framework_honey
Yii php framework_honey
 
Yii workshop
Yii workshopYii workshop
Yii workshop
 
Cancer de mama
Cancer de mamaCancer de mama
Cancer de mama
 
Yii framework
Yii frameworkYii framework
Yii framework
 
Nram presentation 3
Nram presentation 3Nram presentation 3
Nram presentation 3
 
Futex Scaling for Multi-core Systems
Futex Scaling for Multi-core SystemsFutex Scaling for Multi-core Systems
Futex Scaling for Multi-core Systems
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar to A site in 15 minutes with yii

Icinga 2009 at OSMC
Icinga 2009 at OSMCIcinga 2009 at OSMC
Icinga 2009 at OSMC
Icinga
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, Powershell
Roo7break
 
OSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga TeamOSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga Team
NETWAYS
 
You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular Library
Bo-Yi Wu
 
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplicationsGet things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
Giuliano Iacobelli
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
Hung-yu Lin
 
WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
Sanjay Willie
 
Making Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking itMaking Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking it
Tim Plummer
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration Management
Philip Norton
 
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCampHow to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
Jesus Manuel Olivas
 
Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)
ÇözümPARK
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3
kidtangerine
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
ananelson
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
Drupalcon Paris
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
ViSenze - Artificial Intelligence for the Visual Web
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
Michael Zhang
 
How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)
Larry Cashdollar
 
HadoopCon 2016 - 用 Jupyter Notebook Hold 住一個上線 Spark Machine Learning 專案實戰
HadoopCon 2016  - 用 Jupyter Notebook Hold 住一個上線 Spark  Machine Learning 專案實戰HadoopCon 2016  - 用 Jupyter Notebook Hold 住一個上線 Spark  Machine Learning 專案實戰
HadoopCon 2016 - 用 Jupyter Notebook Hold 住一個上線 Spark Machine Learning 專案實戰
Wayne Chen
 
Drupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp BratislavaDrupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp Bratislava
Gábor Hojtsy
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
Gerald Villorente
 

Similar to A site in 15 minutes with yii (20)

Icinga 2009 at OSMC
Icinga 2009 at OSMCIcinga 2009 at OSMC
Icinga 2009 at OSMC
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, Powershell
 
OSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga TeamOSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga Team
 
You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular Library
 
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplicationsGet things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
 
Making Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking itMaking Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking it
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration Management
 
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCampHow to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
 
Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)
 
HadoopCon 2016 - 用 Jupyter Notebook Hold 住一個上線 Spark Machine Learning 專案實戰
HadoopCon 2016  - 用 Jupyter Notebook Hold 住一個上線 Spark  Machine Learning 專案實戰HadoopCon 2016  - 用 Jupyter Notebook Hold 住一個上線 Spark  Machine Learning 專案實戰
HadoopCon 2016 - 用 Jupyter Notebook Hold 住一個上線 Spark Machine Learning 專案實戰
 
Drupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp BratislavaDrupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp Bratislava
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
 

Recently uploaded

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 

Recently uploaded (20)

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 

A site in 15 minutes with yii

  • 1. Building a site in 15 minutes With the Yii Framework
  • 2. What is Yii? • MVC Framework – Model, View, Controller • PHP • Built to be fast, secure and professional – Faster than Cake, Codeigniter, Zend1 • Lots of plumbing already in place – Build a site quickly, don’t reinvent the wheel • Gii GUI for quickly creating application scaffolding – Web-based code generation 1http://www.yiiframework.com/performance/
  • 3. How do we start? • Basic VM image provided – run with VirtualBox – Already set-up : CentOS 6, Nginx, PHP, MySQL, Yii • Some initial personlisation – Login as root, (password yii) – Create a user • useradd -G wheel akelk • passwd akelk • visudo • Make sure wheel can run sudo – Login as yourself (using putty)
  • 4. Creating our site with Yii • Run yiic – Directory already in place, navigate to /var/www/html/yiisite – Initially we run using sudo as all files are owned by nginx – sudo ../../yii/framework/yiic webapp . – Then we’ll change ownership and give ourselves write permissions for easier development purposes – sudo chown -R nginx:wheel .; sudo chmod -R g+w . • Now we’re ready to visit our site – Fire up your favourite browser – Visit the main Yii URL (e.g. http://192.168.0.107/) – Explore the site
  • 5. Configuring our site • Main config file is in protected/config/main.php – Set up access to the mysql database • 'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=iproperty', 'emulatePrepare' => true, 'username' => 'iproperty', 'password' => 'iproperty', 'charset' => 'utf8', ), – Enable the Gii GUI • 'modules'=>array( 'gii'=>array( 'class'=>'system.gii.GiiModule', 'password'=>'iproperty', 'ipFilters'=>array('127.0.0.1','::1','192.168.*'), ), ),
  • 6. Create the scaffolding • Naïve SQL schema – CREATE TABLE `listing` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL, `description` text, `state` varchar(50) DEFAULT NULL, `area` varchar(50) DEFAULT NULL, `price` decimal(10,0) DEFAULT NULL, `status` char(1) DEFAULT NULL, `issale` tinyint(1) DEFAULT NULL, `isrent` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; • Fire up gii and login – http://192.168.0.107/index.php?r=gii – Password is iproperty • Create model (named listing) • Create CRUD (using Listing model and listing controller)
  • 7. Try it out • Add a new listing or two – Using the create action • View the listings – Using the view action • Manage listings – Using the manage action • But no search? – Only accessible via manage when you’re logged in – Let’s create one!
  • 8. Extending our site • Create a search action – Very similar to admin • Allow access to all – Edit the accessRules method • Create a view to render it – Similar to admin but use a CLinkColumn for the grid display – array( 'class'=>'CLinkColumn', 'urlExpression'=> 'Yii::app()->createUrl("listing/view",array("id"=>$data->id))', ), – Re-use _search.php from the admin action
  • 9. Review • For simple CRUD, all you need is a sensible database schema, ActiveRecord and Gii; relationships will help you navigate between objects. • You can add new actions – remember to keep the controllers skinny, the models fat • There’s loads of helper classes: – HTTP Responses (including errors) – Caching (File, MemCache, Opcode caching) – Data structures (Maps, Iterators, Queues) – Validators (String, URL, Number, Email, etc) – Web widgets (grids, forms, inputs) – Web services (SOAP, REST) – I18n (Translating, Messages, Date formats, etc) • Read the documentation