GithubHelp home page GithubHelp logo

viewcounterbundle's Introduction

The View Counter Bundle

Welcome to the "TchoulomViewCounterBundle".

This bundle is used to count the number of views of web pages (the viewership).

This bundle can also be used to draw a graphical representation of statistical data of the web pages.

Monthly views in 2018

Table of contents

Features include

- Viewcounter
- Statistics
- Geolocation

Documentation

The ViewCounter documentation

Original Credits

Created by Ernest TCHOULOM

License

This bundle is released under the MIT license. See the complete license in the bundle:

LICENSE

Enjoy!

viewcounterbundle's People

Contributors

ernestwisniewski avatar tacman avatar tchoulom avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

viewcounterbundle's Issues

Drop unmaintained depdendencies

Dropping older versions of PHP 8 and Symfony would make it easier to update the code. I think that would be Symfony ^6.4|^7.0 and php: ^8.1

Perhaps in conjunction with #17 , as the method signatures would change, e.g. function setViews(?int $views), which is what Symfony make:entity generates if you use it to implement the required methods.

Other stat file method than disk

I use this plugin inside a docker project. I was wondering if there are any other methods than disk cache to store the stats file? My filesystem is read only. Could i use a google droplet for example in combination with gaufrette?

Hope someone has a tip.

Error in Symfony 4.4: @MappedSuperclass annotation is not loaded

I'm trying to install the bundle in symfony 4.4 but i'm getting the following error:

!!    [Semantical Error] The annotation "@MappedSuperclass" in class Tchoulom\Vie  
!!    wCounterBundle\Entity\ViewCounterInterface was never imported. Did you mayb  
!!    e forget to add a "use" statement for this annotation?      

Hope there is an easy fix, seems like a nice bundle!

Does not work with symfony 5

I'm trying to install this cool bundle on symfony 5, but throws a error.

  • tchoulom/view-counter-bundle 3.7.3 requires symfony/framework-bundle ^2.7 || ^3.0 || ^4.0 -> no matching package found.
    • tchoulom/view-counter-bundle 3.7.2 requires symfony/framework-bundle ^2.7 || ^3.0 || ^4.0 -> no matching package found.
    • tchoulom/view-counter-bundle 3.7.1 requires symfony/framework-bundle ^2.7 || ^3.0 || ^4.0 -> no matching package found.
    • tchoulom/view-counter-bundle 3.7.0 requires symfony/framework-bundle ^2.7 || ^3.0 || ^4.0 -> no matching package found.
    • Installation request for tchoulom/view-counter-bundle ^3.7 -> satisfiable by tchoulom/view-counter-bundle[3.7.0, 3.7.1, 3.7.2, 3.7.3].

Storage

I want to use filesystem storage, but get an error
Screenshot_2

tchoulom_viewcounter.yaml
Screenshot_3

composer.json
Screenshot_2

Deprecation warning

Cold you help to resolve this warning:

User Deprecated: The "App\Entity\ViewCounter::setPage()" method will require a new "string $property" argument in the next major version of its parent class "Tchoulom\ViewCounterBundle\Entity\ViewCounter", not defining it is deprecated.

My method now looks like this:

    public function setPage(ViewCountable $page): ViewCounter
    {
        $this->entry = $page;

        return $this;
    }

The warning is not clear about the location of the new argument or if it will replace any existing argument. Or even what to do with the $property value.!?

Error in the doc

Its not:

$this->comments->removeElement($viewCounter);

But

$this->viewCounters->removeElement($viewCounter);

Best

Support Symfony 7

Can you also support Symfony 7? If it works on 6.4, it will likely work on 7.0 as well. Thx

Version 7 Ideas

Cool bundle, thanks for releasing it.

With the next major release, would you consider some of these?

  • Update documentation to PHP 8 / Symfony 6.4+. That is, drop annotations, inject services via dependency injection only. The documentation reflects old versions that are no longer supported.
  • refactor source directories and class names to Symfony Best Practices (bundle source is in /src instead of the base directory, interface classes end with Interface, etc.
  • in particular, "viewcounter" is confusing, $this->viewcounter and $viewcounter are different objects, making this code somewhat complicated for newcomers. "views" could be "viewCount", making it clear that it's an integer and not the viewCount records.
// Viewcounter
    $viewcounter = $this->get('tchoulom.viewcounter')->getViewCounter($article);
    // For Symfony version >= 4
    $viewcounter = $this->viewcounter->getViewCounter($article);
    
    $em = $this->getDoctrine()->getEntityManager();
    
    if ($this->viewcounter->isNewView($viewcounter)) {
        $views = $this->viewcounter->getViews($article);
        $viewcounter->setIp($request->getClientIp());
        $viewcounter->setArticle($article);
        $viewcounter->setViewDate(new \DateTime('now'));

Error message in profiler

Hi,
I have this error on profiler:
The field mybundle\Entity\myentity#viewCounters is on the inverse side of a bi-directional relationship, but the specified mappedBy association on the target-entity mybundle\Entity\ViewCounter#event does not contain the required 'inversedBy="viewCounters"' attribute.
Do i missed something ?

Error when installing under Symfony 6.4


omposer require tchoulom/view-counter-bundle
./composer.json has been updated
Running composer update tchoulom/view-counter-bundle
Loading composer repositories with package information
Updating dependencies                                 
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking tchoulom/view-counter-bundle (6.1.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading tchoulom/view-counter-bundle (6.1.0)
  - Installing tchoulom/view-counter-bundle (6.1.0): Extracting archive
Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead.
Generating optimized autoload files
Class org\nameapi\client\services\riskdetector\riskdetector\PersonRiskDetectorService located in ./vendor/optimaize/nameapi-client-php/src/org/nameapi/client/services/riskdetector/person/PersonRiskDetectorService.php does not comply with psr-4 autoloading standard. Skipping.
Class org\nameapi\client\fault\HttpResponseData located in ./vendor/optimaize/nameapi-client-php/src/org/nameapi/client/http/HttpResponseData.php does not comply with psr-4 autoloading standard. Skipping.
Generated class-metadata map.
214 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Symfony operations: 1 recipe (395724bc13b6efcf4d37f377959b0bbe)
  - Configuring tchoulom/view-counter-bundle (>=6.1.0): From auto-generated recipe
Executing script cache:clear --no-warmup [KO]
 [KO]
Script cache:clear --no-warmup returned with error code 1


Symfony operations: 1 recipe (395724bc13b6efcf4d37f377959b0bbe)
  - Configuring tchoulom/view-counter-bundle (>=6.1.0): From auto-generated recipe
Executing script cache:clear --no-warmup [KO]
 [KO]
Script cache:clear --no-warmup returned with error code 1
!!  
!!  In ArrayNode.php line 233:
!!                                                                                 
!!    The child config "view_counter" under "tchoulom_view_counter" must be confi  
!!    gured: Allows to define the Viewcounter information.                         
!!                                                                                 
!!  
!!  2024-05-12T20:39:47+00:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "Limenius\LiformBundle\LimeniusLiformBundle" now to avoid errors or add an explicit @return annotation to suppress this message.
!!  2024-05-12T20:39:47+00:00 [info] User Deprecated: Method "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()" might add "void" as a native return type declaration in the future. Do the same in implementation "Limenius\LiformBundle\LimeniusLiformBundle" now to avoid errors or add an explicit @return annotation to suppress this message.
!!  2024-05-12T20:39:47+00:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "Tchoulom\ViewCounterBundle\TchoulomViewCounterBundle" now to avoid errors or add an explicit @return annotation to suppress this message.

MySQL Support

First of all, amazing work! Is there any chance you can add (or explain how to add) MySQL support for storage of views + statistics?

Thank you.

Error during composer installation during cache:clear

When running composer require tchoulom/view-counter-bundle, I get this kind of blurry message that makes the install fail.

Composer version: Composer version 2.0.6 2020-11-07 11:21:17
Symfony version:

  • Symfony CLI version v4.21.3 (2020-12-11T09:19:56+0000 - stable)
  • Symfony 5.2.1 (env: dev, debug: true)

image

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.