PHP code example of zoilorys / craft-react-external-server
1. Go to this page and download the library: Download zoilorys/craft-react-external-server library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zoilorys / craft-react-external-server example snippets
return [
'env' => 'client_side',
];
entry.php
# config/react/entry.php
use craft\elements\Entry;
return [
'default' => function(Entry $entry){// named after the group
return [
'id' => $entry->id,
'title' => $entry->title,
'customField' => $entry->customField,
];
}
];