Skip to content

Allow Symfony 5 #122

@tacman

Description

@tacman
Contributor

Symfony5 is out, not sure what's needed to update this bundle. My attempt to simply bump the dependencies didn't work, can we drop PHP5 support?

Also, I think symfony/templating has been deprecated in favor of twig/twig, but I'm not sure how to provide BC for this.

Activity

mikeploeger

mikeploeger commented on Dec 5, 2019

@mikeploeger

+1

mikeploeger

mikeploeger commented on Dec 5, 2019

@mikeploeger

Theres occurring a problem.
This library relies on the Twig_Extension Bundle.

But the Twig/Extensions Bundle is abandoned.
"WARNING: This repository is abandoned in favor of Twig Core Extra extensions."
Source: https://github.com/twigphp/Twig-extensions

The function, that this bundle here is using isn't in the Twig Core Extra extension:
"DateExtension: time_diff filter -> no equivalent"

Has anybody a solution how to make this bundle (or a similar bundle) compatible?

tacman

tacman commented on Dec 5, 2019

@tacman
ContributorAuthor

Really, timeago.js may be part of the solution here. But I'm unclear on what the best practices are using Webpack Encore and requiring a javascript library in a bundle.

What I've been doing is

yarn add timeago

Then

Any idea on how to require a js library from within a Symfony Bundle, and integrate it (automatically?). Then the twig extension becomes easy, at least for that part.

napestershine

napestershine commented on Dec 29, 2019

@napestershine
$ composer require knplabs/knp-time-bundle
Using version ^1.10 for knplabs/knp-time-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Nothing to install or update
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  
!!   // Clearing the cache for the dev environment with debug                       
!!   // true                                                                        
!!  
!!  14:19:35 CRITICAL  [php] Uncaught Error: Class 'Twig_Extension' not found ["exception" => Error { …}]
!!  
!!  In TimeExtension.php line 20:
!!                                                                         
!!    Attempted to load class "Twig_Extension" from the global namespace.  
!!    Did you forget a "use" statement?                                    
!!                                                                         
!!  
!!  cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
!!  
!!  
Script @auto-scripts was called via post-update-cmd

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

mikeploeger

mikeploeger commented on Dec 29, 2019

@mikeploeger

$ composer require knplabs/knp-time-bundle
Using version ^1.10 for knplabs/knp-time-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Nothing to install or update
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! // Clearing the cache for the dev environment with debug
!! // true
!!
!! 14:19:35 CRITICAL [php] Uncaught Error: Class 'Twig_Extension' not found ["exception" => Error { …}]
!!
!! In TimeExtension.php line 20:
!!
!! Attempted to load class "Twig_Extension" from the global namespace.
!! Did you forget a "use" statement?
!!
!!
!! cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]
!!
!!
Script @auto-scripts was called via post-update-cmd

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

Thats because you need to install twig extension bundle (composer require twig/extensions)

But Twig Extension Bundle is incompatible with SF5 ("Your requirements could not be resolved to an installable set of packages.")

So this knp time bundle can't be installed right now.

weaverryan

weaverryan commented on Dec 30, 2019

@weaverryan
Collaborator

Should be better in v1.11.0. If you have any problems, please open a new issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @weaverryan@tacman@napestershine@mikeploeger

      Issue actions

        Allow Symfony 5 · Issue #122 · KnpLabs/KnpTimeBundle