Build a Slim PHP 3 webapp with social logins and emails
Prerequisites
-
PHP 5.6+
Edit php.ini
always_populate_raw_post_data = -1
Uncomment
extension=php_curl.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
extension=php_openssl.dll -
Composer
Linux> curl -sS https://getcomposer.org/installer | php
Windows> Download & Install Composer-Setup.exe
Development Cycle
Windows> php -S 127.0.0.1:8080 -t public_html public_html/index.php
Setup Emails
Follow https://github.com/SparkPost/php-sparkpost
Troubleshooting
PDOException “could not find driver”
You forgot to uncomment extension=php_pdo_mysql.dll in php.ini. See this thread on StackOverflow
storage not found
Redirects not working
#bad $app->get('/login/[{provider}]', function($request, $response, $args) use ($app) { (...) $response->withHeader('Location', '/welcome/'); }
#closer but still not working $app->get('/login/[{provider}]', function($request, $response, $args) use ($app) { (...) $response->withHeader('Location', '/welcome/'); return $response; }
#good $app->get('/login/[{provider}]', function($request, $response, $args) use ($app) { (...) return $response->withHeader('Location', '/welcome/'); }
php-http/client-implementation ^1.0 -> no matching package found
>composer require sparkpost/sparkpost Using version ^2.1 for sparkpost/sparkpost ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for sparkpost/sparkpost ^2.1 -> satisfiable by sparkpost/sparkpost[2.1.0]. - sparkpost/sparkpost 2.1.0 requires php-http/client-implementation ^1.0 -> no matching package found. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details. Solution : You need to install bothguzzlehttp/guzzle andphp-http/guzzle6-adapter
$> composer requireguzzlehttp/guzzle
$> composer require php-http/guzzle6-adapter
then retry
$> composer require sparkpost/sparkpost

Recent Comments