Giter Site home page Giter Site logo

laravel-stats's Introduction

Laravel Stats

Buy us a tree

Get insights about your Laravel or Lumen Project.

Screenshot

Installing

The easiest way to install the package is by using composer.

composer require "wnx/laravel-stats" --dev

The package will automatically register itself.

If you're using Lumen you have to manually register the Service Provider in your bootstrap/app.php file:

$app->register(\Wnx\LaravelStats\StatsServiceProvider::class);

Optionally, you can publish the config file in your Laravel applications with the following command:

php artisan vendor:publish --provider="Wnx\LaravelStats\StatsServiceProvider"

Usage

After installing you can generate the statistics by running the following Artisan Command.

php artisan stats

(Make sure you run php artisan config:clear before running the above command.)

The statistics are also available as JSON.

php artisan stats --json

If you want a more detailed report and see which classes have been grouped into which component, you can use the --verbose-option.

php artisan stats --verbose

The verbose option is available for the JSON format also.

php artisan stats --json --verbose

Note If your project is using Pest PHP for writing tests, these files will automatically be excluded from the statistics. Due to how "laravel-stats" works internally, Pest PHP tests can't currently be detected. See #194 for more information.

How does this package detect certain Laravel Components?

The package scans the files defined in the paths-array in the configuration file. It then applies Classifiers to those classes to determine which Laravel Component the class represents.

Component Classification
Livewire Components Must extend Livewire\Component
Controller Must be registered with a Route & does not extend Livewire\Component
Model Must extend Illuminate\Database\Eloquent\Model
Command Must extend Illuminate\Console\Command
Rule Must extend Illuminate\Contracts\Validation\Rule
Policy The Policy must be registered in your AuthServiceProvider
Middleware The Middleware must be registered in your Http-Kernel
Event Must use Illuminate\Foundation\Events\Dispatchable-Trait
Event Listener Must be registered for an Event in EventServiceProvider
Mail Must extend Illuminate\Mail\Mailable
Notification Must extend Illuminate\Notifications\Notification
Nova Action Must extend Laravel\Nova\Actions\Action
Nova Dashboard Must extend Laravel\Nova\Dashboard
Nova Filter Must extend Laravel\Nova\Filters\Filter
Nova Lens Must extend Laravel\Nova\Lenses\Lens
Nova Resource Must extend Laravel\Nova\Resource
Job Must use Illuminate\Foundation\Bus\Dispatchable-Trait
Migration Must extend Illuminate\Database\Migrations\Migration
Request Must extend Illuminate\Foundation\Http\FormRequest
Resource Must extend Illuminate\Http\Resources\Json\JsonResource or Illuminate\Http\Resources\Json\ResourceCollection
Seeder Must extend Illuminate\Database\Seeder
ServiceProvider Must extend Illuminate\Support\ServiceProvider
Blade Components Must extend Illuminate\View\Component
Custom Casts Must implement Illuminate\Contracts\Database\Eloquent\CastsAttributes or Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes
Database Factory Must extend Illuminate\Database\Eloquent\Factory
Dusk Tests Must extend Laravel\Dusk\TestCase
BrowserKit Test Must extend Laravel\BrowserKitTesting\TestCase
PHPUnit Test Must extend PHPUnit\Framework\TestCase

Create your own Classifiers

If your application has it's own components you would like to see in laravel-stats you can create your own "Classifiers". Create your own Classifiers by implementing the Classifier-contract and adding the class to the stats.custom_component_classifier config array.

For example:

// app/Classifiers/RepositoryClassifier.php
<?php

namespace App\Classifiers;

use Wnx\LaravelStats\ReflectionClass;
use Wnx\LaravelStats\Contracts\Classifier;

class RepositoryClassifier implements Classifier
{
    public function name(): string
    {
        return 'Repositories';
    }

    public function satisfies(ReflectionClass $class): bool
    {
        return $class->isSubclassOf(\App\Repositories\BaseRepository::class);
    }

    public function countsTowardsApplicationCode(): bool
    {
        return true;
    }

    public function countsTowardsTests(): bool
    {
        return false;
    }
}
// config/stats.php
<?php
    ...
    'custom_component_classifier' => [
        \App\Classifiers\RepositoryClassifier::class
    ],
    ...

Treeware

You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees here offset.earth/treeware

Read more about Treeware at treeware.earth

Running the tests

The package has tests written in phpunit. You can run them with the following command.

./vendor/bin/phpunit

Running the command in a local test project

If you're working on the package locally and want to just run the command in a demo project you can use the composer path-repository format. Add the following snippet to the composer.json in your demo project.

{
    "repositories": [
        {
            "type": "path",
            "url": "/path/to/laravel-stats/",
            "options": {
                "symlink": true
            }
        }
    ],
}

And "install" the package with composer require wnx/laravel-stats. The package should now be symlinked in your demo project.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Credits

License

This project is licensed under the MIT License - see the LICENSE file for details.

laravel-stats's People

Contributors

adrianhl avatar aiiro avatar brandonsurowiec avatar carusogabriel avatar csanda87 avatar devcircus avatar dinhquochan avatar dylan-dpc avatar fitztrev avatar hapidjus avatar jamesmills avatar jasonmccreary avatar jerguslejko avatar joaorobertopb avatar keradus avatar krenor avatar mahdimajidzadeh avatar mannil avatar miclf avatar rgasch avatar sebdesign avatar stefanzweifel avatar thecrypticace avatar verron avatar x7ryan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-stats's Issues

Display Number of Routes

I thought about adding the number of routes in a separate row at the bottom of the output table or in a second table.

It could look like this:

bildschirmfoto 2017-10-12 um 22 05 46

(This would be something for 2.0)

Thoughts?

[2.x] Add Observer Classifier

There's currently no classifier for Observers. As Observers are plain PHP Classes which do not extend other classes, detecting those is a bit trickier.

Laravel uses observe and registerObserver under the hood. I don't know how a classifier could loop through this code, but the solution lies somewhere in there 🔮.

ide helper conflict / error

If I have the _ide_helper.php in the directory, the following is produced. If I delete the file, all is good but obviously ide-helper doesn't work :-)

❯ art stats              
PHP Fatal error:  Cannot declare class Artisan, because the name is already in use in /Users/merickson/Documents/code/laravel/l5-sandbox/_ide_helper.php on line 12949

                                                                    
  [Symfony\Component\Debug\Exception\FatalErrorException]           
  Cannot declare class Artisan, because the name is already in use  

[Feature Request] Config option to include vendor classes

Could we include a config option to enable/disable the including of laravel classes inside vendor directory? And maybe display it in a separate table? We need for example to know the total number of service providers in the whole project, not just within the app layer, also artisan commands, and migrations. That would be helpful.. What do you think?

Not installing in Laravel 7

Problem 1
- Conclusion: don't install wnx/laravel-stats v2.1.1
- Conclusion: don't install wnx/laravel-stats v2.1.0|remove sebastian/version 2.0.1
- Conclusion: don't install wnx/laravel-stats v2.1.0|don't install sebastian/version 2.0.1
- Installation request for wnx/laravel-stats ^2.1 -> satisfiable by wnx/laravel-stats[v2.1.0, v2.1.1].
- wnx/laravel-stats v2.1.0 requires phploc/phploc ~6.0 -> satisfiable by phploc/phploc[6.0.0, 6.0.1, 6.0.2, 6.0.x-dev].
- phploc/phploc 6.0.0 requires sebastian/version ^3.0 -> satisfiable by sebastian/version[3.0.0, 3.0.x-dev].
- phploc/phploc 6.0.1 requires sebastian/version ^3.0 -> satisfiable by sebastian/version[3.0.0, 3.0.x-dev].
- phploc/phploc 6.0.2 requires sebastian/version ^3.0 -> satisfiable by sebastian/version[3.0.0, 3.0.x-dev].
- phploc/phploc 6.0.x-dev requires sebastian/version ^3.0 -> satisfiable by sebastian/version[3.0.0, 3.0.x-dev].
- Can only install one of: sebastian/version[3.0.0, 2.0.1].
- Can only install one of: sebastian/version[3.0.x-dev, 2.0.1].
- Installation request for sebastian/version (locked at 2.0.1) -> satisfiable by sebastian/version[2.0.1].

Update to Laravel 5.6

Hi
Laravel 5.6 is coming this week. The package doesn't install on L5.6 due to Illuminate 5.5.* requirements.

Thanks in advance

Controllers with re-namespace cannot work

Hi, I just tried to use this package but I got this issue:

In Container.php line 752:
Class App\Http\Controllers\Auth\LoginController does not exist

As in my app Controllers, I've put namespace as \App\Controllers\Frontend & \App\Controllers\Backend (follow structure from Laravel-Boilerplate ).
Could you please help about this issue?

mb_strpos() expects parameter 1 to be string, object given

Seems I've missed a bug in ControllerClassifier. See error below.

[2017-10-16 19:40:30] local.ERROR: mb_strpos() expects parameter 1 to be string, object given {"exception":"[object] (ErrorException(code: 0): mb_strpos() expects parameter 1 to be string, object given at /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Support/Str.php:103)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'mb_strpos() exp...', '/Users/stefan/D...', 103, Array)
#1 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Support/Str.php(103): mb_strpos(Object(Closure), '@')
#2 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Support/Str.php(264): Illuminate\\Support\\Str::contains(Object(Closure), '@')
#3 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Routing/Route.php(249): Illuminate\\Support\\Str::parseCallback(Object(Closure))
#4 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Routing/Route.php(224): Illuminate\\Routing\\Route->parseControllerCallback()
#5 /Code/stats-demo/vendor/wnx/laravel-stats/src/Classifiers/ControllerClassifier.php(19): Illuminate\\Routing\\Route->getController()
#6 [internal function]: Wnx\\LaravelStats\\Classifiers\\ControllerClassifier->Wnx\\LaravelStats\\Classifiers\\{closure}(Object(Illuminate\\Routing\\Route), 0)
#7 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Support/Collection.php(836): array_map(Object(Closure), Array, Array)
#8 /Code/stats-demo/vendor/wnx/laravel-stats/src/Classifiers/ControllerClassifier.php(20): Illuminate\\Support\\Collection->map(Object(Closure))
#9 /Code/stats-demo/vendor/wnx/laravel-stats/src/Classifiers/Classifier.php(32): Wnx\\LaravelStats\\Classifiers\\ControllerClassifier->satisfies(Object(Wnx\\LaravelStats\\ReflectionClass))
#10 /Code/stats-demo/vendor/wnx/laravel-stats/src/ReflectionClass.php(18): Wnx\\LaravelStats\\Classifiers\\Classifier->classify(Object(Wnx\\LaravelStats\\ReflectionClass))
#11 /Code/stats-demo/vendor/wnx/laravel-stats/src/ReflectionClass.php(23): Wnx\\LaravelStats\\ReflectionClass->getLaravelComponentName()
#12 /Code/stats-demo/vendor/wnx/laravel-stats/src/ComponentSort.php(23): Wnx\\LaravelStats\\ReflectionClass->isLaravelComponent()
#13 [internal function]: Wnx\\LaravelStats\\ComponentSort->Wnx\\LaravelStats\\{closure}(Object(Wnx\\LaravelStats\\ReflectionClass), 191)
#14 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Support/Arr.php(593): array_filter(Array, Object(Closure), 1)
#15 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Support/Collection.php(417): Illuminate\\Support\\Arr::where(Array, Object(Closure))
#16 /Code/stats-demo/vendor/wnx/laravel-stats/src/ComponentSort.php(24): Illuminate\\Support\\Collection->filter(Object(Closure))
#17 /Code/stats-demo/vendor/wnx/laravel-stats/src/Services/StatisticsListService.php(65): Wnx\\LaravelStats\\ComponentSort->sortClassesIntoComponents(Object(Illuminate\\Support\\Collection))
#18 /Code/stats-demo/vendor/wnx/laravel-stats/src/Services/StatisticsListService.php(43): Wnx\\LaravelStats\\Services\\StatisticsListService->findAndSortComponents()
#19 /Code/stats-demo/vendor/wnx/laravel-stats/src/Commands/StatsListCommand.php(33): Wnx\\LaravelStats\\Services\\StatisticsListService->getData()
#20 [internal function]: Wnx\\LaravelStats\\Commands\\StatsListCommand->handle(Object(Wnx\\LaravelStats\\Services\\StatisticsListService))
#21 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#22 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#23 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#24 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#25 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Illuminate\\Container\\Container->call(Array)
#26 /Code/stats-demo/vendor/symfony/console/Command/Command.php(262): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#27 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Console/Command.php(167): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#28 /Code/stats-demo/vendor/symfony/console/Application.php(888): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#29 /Code/stats-demo/vendor/symfony/console/Application.php(224): Symfony\\Component\\Console\\Application->doRunCommand(Object(Wnx\\LaravelStats\\Commands\\StatsListCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#30 /Code/stats-demo/vendor/symfony/console/Application.php(125): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#31 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#32 /Code/stats-demo/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#33 /Code/stats-demo/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#34 {main}
"} 

[New stat] Listeners

Would be cool to add listeners as well. I don't know if its already planned? 🤔

Anyway, if it's not and you would accept a PR for this, I'd gladly put some work into this at some point.

Suggestion: Different output formats?

I've written a helper before that took CLOC output and formatted it in an HTML table.

If that's something that would be useful as a command switch (e.g. --output=stats.html) I'll write it up and submit a PR.

New Classifier: PHPUnit Tests

For the next version, we would like to detect PHPUnit Tests and display their stats.

Detecting a PHPUnit Test should be easy as a Test has to extend the PHPUnit\Framework\TestCase class.

TODOs

We're open for Pull Requests 👋

Conflicts with ide-helper package

Unfortunately, the artisan stats command is in conflict with the generated files from barryvdhs Laravel IDE helper.

When using the command while the ide helper files exist, the following error is thrown:

PHP Fatal error: Cannot declare class App, because the name is already in use in /path/to/_ide_helper.php on line 13814

I know that there can't be a fix for every package conflict, but the laravel ide helper one is very popular among PHPStorm users because it enables autocomplete for them.

How to reproduce

  1. Install the linked package as well as laravel-stats
  2. Use the command php artisan ide-helper:meta && php artisan ide-helper:models -n && php artisan ide-helper:generate. The files are now generated
  3. Try to use php artisan stats
  4. See the error

PHP 7.0 version

Hey!

Is there any chance that the required PHP version will be downgraded from 7.1 to 7.0 (like the latest Laravel release requires)?

[2.x] Add Blade Components Classifier from Laravel 7.0

Laravel 7.0 will ship with several new features. One of them are Blade Components.

I see them as new core component, so it makes sense to update stats to recognise them as such.

Blade Components are easily recognisable, as they extend Illuminate\View\Component. A new classifier should look very similar to all the existing Classifiers which check if a class extends another class (eg. ModelClassifier, RequestClassifier).

I'm happy to accept a well tested PR for this.

Container binding

Is there any particular reason to bind the command to the container? Why not register it using its namespace?

public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/stats.php', 'stats');
$this->app->bind('command.stats:stats-list', StatsListCommand::class);
$this->commands([
'command.stats:stats-list',
]);
}

New Classifier: Dusk Tests

For the next version, we would like to detect Laravel Dusk Tests and display their stats.

Detecting a Dusk should be easy as a Test has to extend the Laravel\Dusk\TestCase class.

TODOs

We're open for Pull Requests 👋

Add Laravel Nova Dashboards Classifier

Laravel Nova recently added support for multiple dashboards. These dashboards extend Laravel\Nova\Dashboard and can therefore be easily recognized with a Classifier.

Documentation: https://nova.laravel.com/docs/2.0/customization/dashboards.html

does it can be used with php7.0?

when I install this package with composert it report a error like this:

  • wnx/laravel-stats v1.0.0-beta requires php ^7.1 -> your PHP version (7.0.24) does not satisfy that requirement.

can you help me? Thank you.

Inconsistent PHP version requirement

In readme there is info about PHP 7.0, in composer.json there is info about PHP 7.0 but when installing via composer in release there is:

"require": {
    "php": "^7.1",
    "illuminate/console": "^5.5",
    "illuminate/support": "^5.5",
    "phploc/phploc": "^4.0",
    "symfony/finder": "^3.3"
},

so when trying to install it seems PHP 7.1 is required. So which one is true - is PHP 7.0 required or PHP 7.1?

Using Docker for unit testing

Hi!

I'd like to propose using docker for unit testing.
Now TravisCI runs multiple PHP versions tests when the PR is created.
I think that it's useful if developers can run phpunit with those versions before creating the new PR.

I think Docker Compose can make it easy for developers to run phpunit with multiple versions.

Thanks.

composer require fails with v2

Hello,

I've updated my app to L6 and it works well. PHP 7.3.

But I can't install laravel-stats:

→ composer require "wnx/laravel-stats" --dev
Using version ^2.0 for wnx/laravel-stats
./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 symfony/console (locked at v4.4.4) -> satisfiable by symfony/console[v4.4.4].
    - Conclusion: don't install phploc/phploc 4.0.0
    - Installation request for wnx/laravel-stats ^2.0 -> satisfiable by wnx/laravel-stats[v2.0.0].
    - Conclusion: don't install sebastian/version 3.0.0|install phploc/phploc 4.0.0
    - Conclusion: remove sebastian/version 3.0.0|install phploc/phploc 4.0.0
    - wnx/laravel-stats v2.0.0 requires phploc/phploc ~4.0|~5.0 -> satisfiable by phploc/phploc[4.0.0, 4.0.1, 5.0.0].
    - phploc/phploc 4.0.1 requires sebastian/version ^2.0 -> satisfiable by sebastian/version[2.0.0, 2.0.1].
    - phploc/phploc 5.0.0 requires sebastian/version ^2.0 -> satisfiable by sebastian/version[2.0.0, 2.0.1].
    - Can only install one of: sebastian/version[2.0.1, 3.0.0].
    - Can only install one of: sebastian/version[2.0.0, 3.0.0].
    - Installation request for sebastian/version (locked at 3.0.0) -> satisfiable by sebastian/version[3.0.0].


Installation failed, reverting ./composer.json to its original content.

Do you have an idea?

Bests

Add Laravel Nova Components

I thought this might be a nice addition to see, how many Resources, Cards and other custom Nova components an app has.

Make package more configurable

The config file for the package should make it easy to configure the following:

  • Ignore Folders / Files
  • Ignore certain Namespaces
  • Ignore Classes

Is laravel 5.5 absolutely required?

Thought this was rad and would like to use it in my laravel app, but I am not yet at 5.5. Are you using features that only exist in 5.5 or can this be 5.*?

[2.x] Add Custom Casts Classifier from Laravel 7.0

Laravel 7.0 will ship with several new features. One of them are Custom Casts.

I see them as new core component, so it makes sense to update stats to recognise them as such.

Custom Casts are easily recognisable, as they implement the Illuminate\Contracts\Database\Eloquent\CastsAttributes or Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes interfaces.

A new classifier should look very similar to the existing RuleClassifier.

I'm happy to accept a well tested PR for this.

Why node_modules is being scanned?!

For some reason when tried the command it gave a strange exception and seems to be scanning node_modules directory, but when I ignored that dir it worked fine. Exception stack:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Sample &mdash; CKEditor</title>
	<link rel="stylesheet" href="sample.css">
</head>
<body>
	<h1 class="samples">
		CKEditor &mdash; Posted Data
	</h1>
	<table border="1" cellspacing="0" id="outputSample">
		<colgroup><col width="120"></colgroup>
		<thead>
			<tr>
				<th>Field&nbsp;Name</th>
				<th>Value</th>
			</tr>
		</thead>
	</table>
	<div id="footer">
		<hr>
		<p>
			CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
		</p>
		<p id="copy">
			Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
		</p>
	</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Sample &mdash; CKEditor</title>
	<link rel="stylesheet" href="sample.css">
</head>
<body>
	<h1 class="samples">
		CKEditor &mdash; Posted Data
	</h1>
	<table border="1" cellspacing="0" id="outputSample">
		<colgroup><col width="120"></colgroup>
		<thead>
			<tr>
				<th>Field&nbsp;Name</th>
				<th>Value</th>
			</tr>
		</thead>
	</table>
	<div id="footer">
		<hr>
		<p>
			CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
		</p>
		<p id="copy">
			Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
		</p>
	</div>
</body>
</html>
PHP Warning:  Uncaught ErrorException: require(../../../../examples/server_side/scripts/ssp.class.php): failed to open stream: No such file or directory in /home/vagrant/Code/rinvex/cortex/node_modules/admin-lte/plugins/datatables/extensions/Scroller/examples/data/ssp.php:53
Stack trace:
#0 /home/vagrant/Code/rinvex/cortex/node_modules/admin-lte/plugins/datatables/extensions/Scroller/examples/data/ssp.php(53): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'require(../../....', '/home/vagrant/C...', 53, Array)
#1 /home/vagrant/Code/rinvex/cortex/node_modules/admin-lte/plugins/datatables/extensions/Scroller/examples/data/ssp.php(53): require()
#2 /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php(83): require_once('/home/vagrant/C...')
#3 /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php(65): Wnx\LaravelStats\ClassFinder->requireClassesFromFiles(Object(Symfony\Component\Finder\Finder))
#4 /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/Cl in /home/vagrant/Code/rinvex/cortex/node_modules/admin-lte/plugins/datatables/extensions/Scroller/examples/data/ssp.php on line 53
PHP Stack trace:
PHP   1. {main}() /home/vagrant/Code/rinvex/cortex/artisan:0
PHP   2. Cortex\Foundation\Console\Kernel->handle() /home/vagrant/Code/rinvex/cortex/artisan:39
PHP   3. Illuminate\Console\Application->run() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:121
PHP   4. Illuminate\Console\Application->run() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Console/Application.php:88
PHP   5. Illuminate\Console\Application->doRun() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Application.php:125
PHP   6. Illuminate\Console\Application->doRunCommand() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Application.php:224
PHP   7. Wnx\LaravelStats\Commands\StatsListCommand->run() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Application.php:888
PHP   8. Wnx\LaravelStats\Commands\StatsListCommand->run() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Console/Command.php:167
PHP   9. Wnx\LaravelStats\Commands\StatsListCommand->execute() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Command/Command.php:264
PHP  10. Illuminate\Foundation\Application->call() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Console/Command.php:180
PHP  11. Illuminate\Container\BoundMethod::call() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/Container.php:549
PHP  12. Illuminate\Container\BoundMethod::callBoundMethod() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
PHP  13. Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
PHP  14. call_user_func_array:{/home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29}() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
PHP  15. Wnx\LaravelStats\Commands\StatsListCommand->handle() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
PHP  16. Wnx\LaravelStats\Services\StatisticsListService->getData() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/Commands/StatsListCommand.php:33
PHP  17. Wnx\LaravelStats\Services\StatisticsListService->findAndSortComponents() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/Services/StatisticsListService.php:43
PHP  18. Wnx\LaravelStats\ClassFinder->getDeclaredClasses() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/Services/StatisticsListService.php:65
PHP  19. Wnx\LaravelStats\ClassFinder->findAndLoadClasses() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php:38
PHP  20. Wnx\LaravelStats\ClassFinder->requireClassesFromFiles() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php:65
PHP  21. require_once() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php:83
PHP Fatal error:  Wnx\LaravelStats\ClassFinder::main(): Failed opening required '../../../../examples/server_side/scripts/ssp.class.php' (include_path='.:/usr/share/php') in /home/vagrant/Code/rinvex/cortex/node_modules/admin-lte/plugins/datatables/extensions/Scroller/examples/data/ssp.php on line 53
PHP Stack trace:
PHP   1. {main}() /home/vagrant/Code/rinvex/cortex/artisan:0
PHP   2. Cortex\Foundation\Console\Kernel->handle() /home/vagrant/Code/rinvex/cortex/artisan:39
PHP   3. Illuminate\Console\Application->run() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:121
PHP   4. Illuminate\Console\Application->run() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Console/Application.php:88
PHP   5. Illuminate\Console\Application->doRun() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Application.php:125
PHP   6. Illuminate\Console\Application->doRunCommand() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Application.php:224
PHP   7. Wnx\LaravelStats\Commands\StatsListCommand->run() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Application.php:888
PHP   8. Wnx\LaravelStats\Commands\StatsListCommand->run() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Console/Command.php:167
PHP   9. Wnx\LaravelStats\Commands\StatsListCommand->execute() /home/vagrant/Code/rinvex/cortex/vendor/symfony/console/Command/Command.php:264
PHP  10. Illuminate\Foundation\Application->call() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Console/Command.php:180
PHP  11. Illuminate\Container\BoundMethod::call() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/Container.php:549
PHP  12. Illuminate\Container\BoundMethod::callBoundMethod() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
PHP  13. Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
PHP  14. call_user_func_array:{/home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29}() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
PHP  15. Wnx\LaravelStats\Commands\StatsListCommand->handle() /home/vagrant/Code/rinvex/cortex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
PHP  16. Wnx\LaravelStats\Services\StatisticsListService->getData() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/Commands/StatsListCommand.php:33
PHP  17. Wnx\LaravelStats\Services\StatisticsListService->findAndSortComponents() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/Services/StatisticsListService.php:43
PHP  18. Wnx\LaravelStats\ClassFinder->getDeclaredClasses() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/Services/StatisticsListService.php:65
PHP  19. Wnx\LaravelStats\ClassFinder->findAndLoadClasses() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php:38
PHP  20. Wnx\LaravelStats\ClassFinder->requireClassesFromFiles() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php:65
PHP  21. require_once() /home/vagrant/Code/rinvex/cortex/vendor/wnx/laravel-stats/src/ClassFinder.php:83


  [Symfony\Component\Debug\Exception\FatalErrorException]
  Wnx\LaravelStats\ClassFinder::main(): Failed opening required '../../../../examples/server_side/scripts/ssp.class.php' (include_path='.:/usr/share/php')

Category 'Others'

I propose we introduce a new category named 'Others'. This would include all classes that are not picked up by any of the classifiers and therefore display statistics for the custom stuff as well.

I have an implementation in mind. What do you think?

getting errors

i'm getting this error when i run php artisan stats

Symfony\Component\Debug\Exception\FatalErrorException  : Cannot declare class App\Content, because the name is already in use at /Applications/MAMP/htdocs/v5/app/Content.php:40
    36|         fwrite($ifp, base64_decode($data[1]));
    37|         fclose($ifp);
    38|         return $output_file;
    39|     }
  > 40| }
    41| 

in Content.php i have this

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\CssSelector\CssSelector;

class Content extends Model
{
    public function menu(){
        return $this->hasOne('App\Menu','id', 'category_id');
    }

    public static function processContent($content){
        $crawler = new Crawler($content);
        $crawler = $crawler->filter('img');
        foreach ($crawler as $domElement) {
            $c = new Crawler($domElement);
            $base64_string =  $c->attr('src');
            if(strpos($base64_string,'base64')) {
                $filename =  $c->attr('data-filename');
                $filename = 'uploads/'.$filename;
                $imageUrl = URL::to($filename);
                self::base64_to_jpeg($base64_string, $filename);
                $content = str_replace($base64_string,$imageUrl,$content);
            }
        }
        $content = str_replace('<img','<img class="img-thumbnail margin-10" ',$content);
        return $content;
    }

    public static function base64_to_jpeg($base64_string, $output_file) {
        $ifp = fopen($output_file, "wb");
        $data = explode(',', $base64_string);
        fwrite($ifp, base64_decode($data[1]));
        fclose($ifp);
        return $output_file;
    }
}

Any idea why? or ho to fix this? Thanks

Add Tests To Statistics

How about adding a breakdown for Tests and any associated sub directories

total 48
drwxr-xr-x   8 merickson  staff   272B Sep  1 23:32 Assert
drwxr-xr-x   6 merickson  staff   204B Sep  1 23:32 Browser
-rw-r--r--   1 merickson  staff   1.8K Sep 17 19:15 DatabaseTestCase.php
-rw-r--r--   1 merickson  staff   740B Sep  1 23:32 DuskTestCase.php
drwxr-xr-x  11 merickson  staff   374B Sep  5 11:41 Feature
-rw-r--r--   1 merickson  staff   146B Sep  1 23:32 FeatureTestCase.php
drwxr-xr-x   3 merickson  staff   102B Sep  1 23:32 Mfour
-rw-r--r--   1 merickson  staff   777B Sep  1 23:32 TestCase.php
drwxr-xr-x   7 merickson  staff   238B Sep  1 23:32 Traits
drwxr-xr-x  11 merickson  staff   374B Sep 17 14:14 Unit
-rw-r--r--   1 merickson  staff   147B Sep  1 23:32 UnitTestCase.php
drwxr-xr-x  15 merickson  staff   510B Sep  1 23:32 coverage
-rw-r--r--   1 merickson  staff   339B Sep  1 23:32 helpers.php

[Feature request] Recognize tests when they extend Tests\TestCase

EDIT: Nvm, I just failed and didn't include the tests folder. (Why isn't it included by default 🤔?)

In Laravel, the default tests (and subsequently tests build through php artisan make:test <NAME> extend the Tests\TestCase class, not the PHPUnit\Framework\TestCase class (reference).

So all of my tests are not recognized by Laravel Stats currently:
screenshot from 2017-11-14 12-09-15

Could the recognition constraints for tests be changed?

rescue function not exist in Lumen

rescue function at laravel/framework/src/Illuminate/Foundation/helpers.php with Laravel framework, but Lumen not exist.

if (! function_exists('rescue')) {
    /**
     * Catch a potential exception and return a default value.
     *
     * @param  callable  $callback
     * @param  mixed  $rescue
     * @return mixed
     */
    function rescue(callable $callback, $rescue = null)
    {
        try {
            return $callback();
        } catch (Throwable $e) {
            report($e);

            return value($rescue);
        }
    }
}

It is not compatible with PHP 7.3

After trying with PHP 7.3.1, I encountered this issue:
"
...
In Analyser.php line 92:

"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
..
"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.