PHP frameworks

From Wildsong
Jump to navigationJump to search

Currently I am only looking at Cake. There is a book. http://it-ebooks.info/book/2489/ Of course, it was written for Cake 2 and Cake 3 was released a week ago. That's how it goes with computer books.

There are about a zillion other PHP frameworks. But I started here. Today.

Cake.php

I grabbed the source by cloning from Git. https://github.com/cakephp/cakephp.git Then I read the docs page and realized all I need to get started is Composer. Composer is a dependency manager.

# Required for Cake. Can't be installed by Composer.
sudo apt-get install php5-intl

cd /var/www/testing
# Get composer
curl -sS https://getcomposer.org/installer
# Create a new project called "firewall" using the Cake application skeleton
php composer.phar create-project --prefer-dist cakephp/app firewall

I set DOCROOT to firewall/webroot and... Now I wonder if it works... http://testing.wildsong.biz/index.php YAY, it does! It generates a report that's all green except for a database. I want to connect it to a database since that is what this is for... I already had a 'firewall' database so I added a user 'cake_firewall', had phpmyadmin generate a password, and copied the relevant information into firewall/config/app.php

Now it's all green. So far, so rapid!

"To change the content of this page, edit: src/Template/Pages/home.ctp" Yes I have done that already.

Cake tutorials (copied from the original version of the page)

  1. Cake docs http://book.cakephp.org/3.0/en/
  2. Bookmarker tutorial http://book.cakephp.org/3.0/en/tutorials-and-examples/bookmarks/intro.html
  3. Blog tutorial http://book.cakephp.org/3.0/en/tutorials-and-examples/blog/blog.html

What is the Front Controller pattern? https://en.wikipedia.org/wiki/Front_Controller_pattern It means there is one file index.php that acts as the window into the application. So, it's like this Wiki. Every URL starts with index.php? and it's the REST of the URL that determines what page comes up.

Cake plugins

Always have to have lots and lots of plugins http://plugins.cakephp.org/packages

Cake User plugin

I want my firewall to be viewable by users and editable by admins and inaccessible to anyone else, so this is high on my list of needs. I watched a youtube video on CakeDC so I am trying theirs.

The instructions in Installation.md are wrong, at least for Cake 3.0.

  1. The cake command is now in the bin/ directory, not Console/
  2. Adding CakePlugin::load('Users'); to bootstrap.php is wrong; after copying the plugin to the plugins directory

use a command bin/cake plugin load Users

  1. The cake 'schema' shell is gone in 3. Use Migrations, which is now included.
  2. The migrations command "bin/cake Migrations.migration run all --plugin Users" does not work because there is no 'run' command.

Case is wrong on the Users config directory. It's Config and it should be config.

Knockout.js

Can I use Cake + Knockout? Yes. http://stackoverflow.com/questions/6456982/cakephp-knockout-js