22
BAKE YOUR CAKE AND EAT IT TOO ! BY PATRICK R . ALEXANDER

BAKE YOUR CAKE AND EAT IT TOO - WPBICO€¦ · WHAT IS CAKE & WHY? • Architecture for developing, maintaining, and deploying applications. • Free & Open Source. • Rapid Development

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

BAKE YOUR CAKE AND EAT IT TOO !

BY PATRICK R . ALEXANDER

WHAT IS CAKE & WHY? •  Architecture for developing, maintaining, and deploying

applications. •  Free & Open Source. •  Rapid Development Frame Work Based Around MVC

Methodology. •  Templating, Helpers, Components. In short reusable code! •  Built in Email, Cookie, Security, Session & Request Handling

Components. •  Caching.

CAKEPHP 3.4 RED VELVET

•  CakePHP 3 is a web development framework running on PHP 7.1 (min. PHP 5.6.0).

BASIC FEATURES

•  Model, View, Controller Architecture •  Application Scaffolding •  Code generation via Bake •  Helpers for HTML, Forms, Pagination, AJAX,

Javascript, XML, RSS and more •  Access Control Lists and Authentication •  Simple yet extensive validation of model data

BASIC FEATURES CONT. •  Router for mapping urls and handling extensions •  Security, Session, and RequestHandler

Components •  Utility classes for working with Files, Folders,

Arrays and more

MOVING PARTS

MODLE VIEW CONTROLLER

•  Model View Controller design patter is based upon separating your code into three sections. –  The Model represents the application data. –  The View renders a presentation of the model

data. –  The Controller handles & routes requests

made by the client.

MODLE VIEW CONTROLLER

BASIC PRINCIPLES OF CAKEPHP

•  Conventions •  Extensions

–  Controller Extensions - Components –  View Extensions - Helpers –  Model Extensions - Behaviors –  CSS/HTML - Elements

REQUIREMENTS

•  HTTP Server. For example: Apache. Having mod_rewrite is preferred, but by no means required.

•  PHP 5.6.0 or greater (including PHP 7.1). •  mbstring PHP extension •  intl PHP extension

REQUIREMENTS CakePHP supports a variety of database storage engines: •  MySQL (5.1.10 or greater) •  PostgreSQL •  Microsoft SQL Server (2008 or higher) •  SQLite 3

INSTALLATION •  CHECK PHP VERSION (php -v)(PHP 5.6 or

greater) •  INSTALL COMPOSER / OVEN •  CREATE PHP PROJECT (php composer.phar create-project --prefer-dist cakephp/app my_app_name) •  PERMISSIONS

PERMISSIONS CakePHP uses the tmp directory for a number of different operations. Model descriptions, cached views, and session information are a few examples. The logs directory is used to write log files by the default FileLog engine. One common issue is that logs and tmp directories and subdirectories must be writable both by the web server and the command line user. (chmod –R 777)

FYI 99.9% of issues that you’ll come across will be related to file permissions

HOW DOES IT WORK? DIRECTORY STRUCTURE

HOW DOES IT WORK? URL

•  www.mycakeapp.com/controller/action/params/

CREATE DATABASE CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY,

email VARCHAR(255) NOT NULL,

password VARCHAR(255) NOT NULL, created DATETIME,

modified DATETIME

);

DATABASE CONFIGURATION replace the values in the Datasources.default array in the config/app.php

BAKE YOUR CAKE ! ~generating scaffold code

BAKE YOUR CAKE !

BAKE YOUR CAKE !

CONNECT WITH ME @balambi [email protected] urls: www.balambico.co www.wpbico.com

RESOURCES https://cakephp.org/ https://book.cakephp.org/ https://book.cakephp.org/3.0/en/intro.html http://groups.google.com/group/cake-php