Merge pull request #324 from filp/remove-phalcon

Remove Phalcon from core
This commit is contained in:
Denis Sokolov
2015-11-22 13:30:25 +02:00
3 changed files with 1 additions and 96 deletions
+1 -3
View File
@@ -26,8 +26,6 @@ powerful stacked error handling system.
- Includes the ability to [open referenced files directly in your editor and IDE](docs/Open%20Files%20In%20An%20Editor.md)
- Includes handlers for different response formats (JSON, XML, SOAP)
- Includes a Silex Service Provider for painless integration with [Silex](http://silex.sensiolabs.org/)
- Includes a Phalcon Service Provider for painless integration with [Phalcon](http://phalconphp.com/)
- Includes a Module for equally painless integration with [Zend Framework 2](http://framework.zend.com/)
- Easy to extend and integrate with existing libraries
- Clean, well-structured & tested code-base
@@ -35,7 +33,7 @@ powerful stacked error handling system.
If you use Laravel 4, you already have Whoops. There are also community-provided instructions on how to integrate Whoops into
[Silex](docs/Framework%20Integration.md#integrating-with-silex),
[Silex 2](https://github.com/texthtml/whoops-silex),
[Phalcon](docs/Framework%20Integration.md#integrating-with-phalcon),
[Phalcon](https://github.com/whoops-php/phalcon),
[Laravel 3](https://gist.github.com/hugomrdias/5169713#file-start-php),
[Laravel 5](https://mattstauffer.co/blog/bringing-whoops-back-to-laravel-5),
[CakePHP 2](https://github.com/oldskool/WhoopsCakephp/tree/cake2),
-15
View File
@@ -32,21 +32,6 @@ $app['whoops'] = $app->extend('whoops', function ($whoops) {
```
# Integrating with Phalcon
**whoops** comes packaged with a Phalcon Service Provider: `Whoops\Provider\Phalcon\WhoopsServiceProvider`. Using it
in your existing Phalcon project is easy. The provider uses the default Phalcon DI unless you pass a DI instance into the constructor.
```php
new Whoops\Provider\Phalcon\WhoopsServiceProvider();
// --- or ---
$di = new Phalcon\DI\FactoryDefault();
new Whoops\Provider\Phalcon\WhoopsServiceProvider($di);
```
# Contributing an integration with a framework
Lately we're prefering to keep integration libraries out of the Whoops core.
@@ -1,78 +0,0 @@
<?php
/**
* Whoops - php errors for cool kids
* @author Filipe Dobreira <http://github.com/filp>
*/
namespace Whoops\Provider\Phalcon;
use Phalcon\DI;
use Phalcon\DI\Exception;
use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
class WhoopsServiceProvider
{
/**
* @param DI $di
*/
public function __construct(DI $di = null)
{
if (!$di) {
$di = DI::getDefault();
}
// There's only ever going to be one error page...right?
$di->setShared('whoops.pretty_page_handler', function () {
return new PrettyPageHandler();
});
// There's only ever going to be one error page...right?
$di->setShared('whoops.json_response_handler', function () {
$jsonHandler = new JsonResponseHandler();
$jsonHandler->onlyForAjaxRequests(true);
return $jsonHandler;
});
// Retrieves info on the Phalcon environment and ships it off
// to the PrettyPageHandler's data tables:
// This works by adding a new handler to the stack that runs
// before the error page, retrieving the shared page handler
// instance, and working with it to add new data tables
$phalcon_info_handler = function () use ($di) {
try {
$request = $di['request'];
} catch (Exception $e) {
// This error occurred too early in the application's life
// and the request instance is not yet available.
return;
}
// Request info:
$di['whoops.pretty_page_handler']->addDataTable('Phalcon Application (Request)', array(
'URI' => $request->getScheme().'://'.$request->getServer('HTTP_HOST').$request->getServer('REQUEST_URI'),
'Request URI' => $request->getServer('REQUEST_URI'),
'Path Info' => $request->getServer('PATH_INFO'),
'Query String' => $request->getServer('QUERY_STRING') ?: '<none>',
'HTTP Method' => $request->getMethod(),
'Script Name' => $request->getServer('SCRIPT_NAME'),
//'Base Path' => $request->getBasePath(),
//'Base URL' => $request->getBaseUrl(),
'Scheme' => $request->getScheme(),
'Port' => $request->getServer('SERVER_PORT'),
'Host' => $request->getServerName(),
));
};
$di->setShared('whoops', function () use ($di,$phalcon_info_handler) {
$run = new Run();
$run->pushHandler($di['whoops.pretty_page_handler']);
$run->pushHandler($phalcon_info_handler);
$run->pushHandler($di['whoops.json_response_handler']);
return $run;
});
$di['whoops']->register();
}
}