Tag Archives: get

CakePHP3 Cache Example – Using Curl to get a Web page contents

Heres a simple example of using the cache feature of cakephp. We want to grab a webpage contents from the web but we only want to do this once otherwise its going to be slow and waste resources.

The basic idea is that we check if the url is saved in cache, if it is then we read it in otherwise we must use curl to grab it.

CakePHP3’s Cache settings are in the config/app.php file;

* Configure the cache adapters.
'Cache' => [
'default' => [
'className' => 'File',
'path' => CACHE,
'url' => env('CACHE_DEFAULT_URL', null),
'duration' => '+60 minutes',//the duration object should cached for
/*'prefix' => 'mycacheprefix_',*/



CakePHP 3 Cache:

Cakephp3-form methods GET and POST

to set the method your form is send in cakephp3 as GET;

echo $this->Form->create(null, ['type' => 'get']);

to get the Data sent via get in controller;



//set the method
echo $this->Form->create(null, ['type' => 'post']);


//get data

Forms in cakephp3: