Started working on a PHP refactor for this service

This commit is contained in:
Erick Ruiz de Chavez 2018-04-04 15:35:36 -04:00
parent 6be98cf3cc
commit 2de6589222
No known key found for this signature in database
GPG key ID: 41B39A480CFAA1A2
5 changed files with 162 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules
development.yml
production.yml
vendor

6
composer.json Normal file
View file

@ -0,0 +1,6 @@
{
"require": {
"rmccue/requests": "^1.7",
"xamin/handlebars.php": "^0.10.4"
}
}

109
composer.lock generated Normal file
View file

@ -0,0 +1,109 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "a54bd6daf1501e5092742fd20e496fec",
"packages": [
{
"name": "rmccue/requests",
"version": "v1.7.0",
"source": {
"type": "git",
"url": "https://github.com/rmccue/Requests.git",
"reference": "87932f52ffad70504d93f04f15690cf16a089546"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546",
"reference": "87932f52ffad70504d93f04f15690cf16a089546",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
"requests/test-server": "dev-master"
},
"type": "library",
"autoload": {
"psr-0": {
"Requests": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Ryan McCue",
"homepage": "http://ryanmccue.info"
}
],
"description": "A HTTP library written in PHP, for human beings.",
"homepage": "http://github.com/rmccue/Requests",
"keywords": [
"curl",
"fsockopen",
"http",
"idna",
"ipv6",
"iri",
"sockets"
],
"time": "2016-10-13T00:11:37+00:00"
},
{
"name": "xamin/handlebars.php",
"version": "v0.10.4",
"source": {
"type": "git",
"url": "https://github.com/XaminProject/handlebars.php.git",
"reference": "b85cee07eae96db0e1eec224ca90f5ce1e4d857a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/XaminProject/handlebars.php/zipball/b85cee07eae96db0e1eec224ca90f5ce1e4d857a",
"reference": "b85cee07eae96db0e1eec224ca90f5ce1e4d857a",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "~4.4",
"squizlabs/php_codesniffer": "~1.5"
},
"type": "library",
"autoload": {
"psr-0": {
"Handlebars": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "fzerorubigd",
"email": "fzerorubigd@gmail.com"
},
{
"name": "Behrooz Shabani (everplays)",
"email": "everplays@gmail.com"
}
],
"description": "Handlebars processor for php",
"homepage": "https://github.com/XaminProject/handlebars.php",
"time": "2016-12-12T13:51:02+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

BIN
composer.phar Executable file

Binary file not shown.

46
index.php Normal file
View file

@ -0,0 +1,46 @@
<?php
require_once './vendor/autoload.php';
// phpinfo();
// $response = Requests::get('https://api.github.com/events');
// var_dump(json_decode($response->body));
// var_dump($_GET);
// var_dump($_POST);
$method = $_SERVER['REQUEST_METHOD'];
// if ($method == 'GET') {
// echo 'contact running';
// exit;
// }
const FORM_FIELDS = [
'_from',
'_subject',
'_to',
'_attachment',
];
const PRIVATE_FIELDS = [
'_fake',
'_info',
'_next',
];
$formData = [
'from' => $_POST['_from'],
'subject' => $_POST['_subject'],
'to' => $_POST['_to'],
'attachment' => $_POST['_attachment'],
];
$fields = [
'fake' => $_POST['_fake'],
'info' => $_POST['_info'],
'next' => $_POST['_next'],
];
var_dump($formData, $fields);
echo 'DONE';