Non c'è PHP
ma nodeJS
disponibili per lo scripting server-side ...
Google Cloud Functions sono scritti in JavaScript, ed eseguire in un runtime Node.js.
Mandrillo supporta anche nodeJS ed è dotato di un Webhooks API. Pertanto, è possibile richiedere quel modulo nodo all'interno di queste "funzioni cloud" e "web hook" ... e quindi pubblicare su di essi un modulo HTML.
Dovrebbero esserci alcune funzioni cloud HTTP definite nella Console di Firebase, per consentire loro di iscriversi, annullare l'iscrizione e gestire le proprie sottoscrizioni. Si potrebbe anche generare il markup HTML per il modulo di input con le funzioni cloud e quindi collegarlo. A titolo di esempio, non testato e nessuna garanzia incluso:
const functions = require('firebase-functions');
const mandrill = require('mandrill-api/mandrill');
var client = new mandrill.Mandrill('YOUR_API_KEY');
/* TODO: add the user on Firebase, respond through the API */
exports.user_add = functions.https.onRequest((req, res) => {
});
/* TODO: change subscription settings on Firebase, respond through the API */
exports.user_edit = functions.https.onRequest((req, res) => {
});
/* TODO: remove the user on Firebase, respond through the API */
exports.user_remove = functions.https.onRequest((req, res) => {
});
/* optional: generate the HTML markup of the form, send HTTP response */
exports.markup = functions.https.onRequest((req, res) => {
});
Si può legare gli eventi della Firebase Auth, per mantenere due database utente in in-sync (questo non è richiesto per Mandrillo, ma necessario per MailChimp - no importa se con il PHP o nodeJS involucro):
exports.on_user_create = functions.auth.user().onCreate(event => {
const user = event.data;
});
exports.on_user_delete = functions.auth.user().onDelete(event => {
const user = event.data;
});
Firebase on Websites spiega tutto, mentre v'è un locale Emulator per le funzioni cloud.
fonte
2017-06-06 08:14:16
Controllare il file Apache _httpd.conf_ (o _/extra/mod_php.conf_) e aggiungere/uncomment 'Applicazione AddType/x-httpd-php .php' – fusion3k
L'hosting di Firebase è solo per file statici - nessun PHP o altro server elaborazione a lato – Clive
Cross-post: https://groups.google.com/forum/#!topic/firebase-talk/m-m1eVPQ7OA –