furey / tinx

⛔️ Laravel Tinx is archived and no longer maintained.
449 stars 37 forks source link

command "tinx" is not defined #30

Closed JatinSethi closed 6 years ago

JatinSethi commented 7 years ago

Hi,

I followed the documentation to install and run the tinx; but I am getting an exception Please refer to the below screenshot. I have tried this on laravel 5.4.27 and lumen 5.4, both having tinker pre-installed.

image

Thanks.

ajthinking commented 7 years ago

Thanks for reporting this @JatinSethi I am not able to reproduce. I just tried it on a fresh laravel installation and it works. I assume you added the serviceprovider to config/app.php providers array when testing 5.4? As it does not have package discovery.

Can you provide any other clues? Like your enviroment etc.

JatinSethi commented 7 years ago

Sure.

I am running Laravel and Lumen for two different projects on a windows machine. Laravel version is 5.4.27. MySql version is 5.7.19 Tinker has been already installed.

I performed these steps:

  1. Ran Composer require ajthinking/tinx
  2. Added "Ajthinking\Tinx\TinxSeriveProvider::class" to the providers array (\config\app.php) in the laravel application
  3. ran composer dumpautoload once again
  4. ran php artisan tinx and I got below screen:

image

Did I miss something here?

countnoobula commented 7 years ago

Hey @JatinSethi

I'm also running Laravel 5.4.27 with Tinx 0.8.2 and it seems to work fine this side, I'll try help how I can 😄

First off, may I ask if this was a potential typo? Ajthinking\Tinx\TinxSeriveProvider::class should be Ajthinking\Tinx\TinxServiceProvider::class 🙂

It should complain of the service provider not being found though, so assuming that doesn't resolve the issue, is there a chance you can post a snippet of your providers array please?

If you could also tell us what version of ajthinking/tinx you have installed, it may help us narrow down 😄

JatinSethi commented 7 years ago

@countnoobula Yeah, that was a typo. Sorry for that. Find below the two snips, one for tinx version and another one for the providers array.

Here is the snip of composer.json

image

and here is the snip of the providers array

image

furey commented 6 years ago

Hi @JatinSethi,

I'd love to help you get Tinx up and running as it's a wonderful tool I happily use every day.

On my Mac (macOS 10.12.6), I've just created two new Laravel projects using the nearest available Laravel releases to your 5.4.27 application:

composer create-project laravel/laravel=5.4.23 laravel-5.4.23 --prefer-dist
composer create-project laravel/laravel=5.4.30 laravel-5.4.30 --prefer-dist

Into both, I required ajthinking/tinx (currently at version 2.0.0 aka "^2.0"):

composer require ajthinking/tinx

Also into both, I added the relevant service provider to config/app.php:

<?php

// 'config/app.php'

return [

    // etc…

    'providers' => [

        // etc…

        /*
         * Package Service Providers...
         */
        Laravel\Tinker\TinkerServiceProvider::class,
        Ajthinking\Tinx\TinxServiceProvider::class,

        // etc…

    ],

    // etc…

];

From each project's root, I ran the tinx console command…

php artisan tinx

…and was able to confirm that Tinx booted correctly each time:

tinx

If you would like further help and have the time, could you please:

• Replicate the steps above and provide success/failure feedback • If failure, provide your operating system details so I can replicate via virtual machine

If you aren't after help and are content to close the issue, please do so.

Cheers!

🤓👍

dmytro-y-dev commented 6 years ago

Can't make it work, have an issue with laravel 5.4 in 1.0.1 and 2.0

vagrant@localhost:/vagrant/website$ php artisan ca:cl -vvv
PHP Parse error:  syntax error, unexpected 'for' (T_FOR) in /vagrant/website/vendor/ajthinking/tinx/src/Console/TinxCommand.php on line 94
PHP Stack trace:
PHP   1. {main}() /vagrant/website/artisan:0
PHP   2. Illuminate\Foundation\Console\Kernel->handle() /vagrant/website/artisan:36
PHP   3. Illuminate\Foundation\Console\Kernel->getArtisan() /vagrant/website/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122
PHP   4. Illuminate\Console\Application->__construct() /vagrant/website/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:284
PHP   5. Illuminate\Console\Application->bootstrap() /vagrant/website/vendor/laravel/framework/src/Illuminate/Console/Application.php:58
PHP   6. Illuminate\Support\ServiceProvider->Illuminate\Support\{closure}() /vagrant/website/vendor/laravel/framework/src/Illuminate/Console/Application.php:111
PHP   7. Illuminate\Console\Application->resolveCommands() /vagrant/website/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:232
PHP   8. Illuminate\Console\Application->resolve() /vagrant/website/vendor/laravel/framework/src/Illuminate/Console/Application.php:206
PHP   9. Illuminate\Foundation\Application->make() /vagrant/website/vendor/laravel/framework/src/Illuminate/Console/Application.php:192
PHP  10. Illuminate\Container\Container->make() /vagrant/website/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:728
PHP  11. Illuminate\Container\Container->resolve() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/Container.php:575
PHP  12. Illuminate\Container\Container->build() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/Container.php:608
PHP  13. ReflectionClass->__construct() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/Container.php:729
PHP  14. spl_autoload_call() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/Container.php:729
PHP  15. Composer\Autoload\ClassLoader->loadClass() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/Container.php:729
PHP  16. Composer\Autoload\includeFile() /vagrant/website/vendor/composer/ClassLoader.php:322

  [Symfony\Component\Debug\Exception\FatalErrorException]  
  syntax error, unexpected 'for' (T_FOR)                   

I performed steps from furey's comments.

dmytro-y-dev commented 6 years ago

Guys, you really should provide compatibility notes in Readme if you make some breaking changes, as well as up to date installation instructions.

0.8.3 also doesn't work for me:

PHP Parse error:  syntax error, unexpected 'for' (T_FOR) in /vagrant/website/vendor/ajthinking/tinx/src/Model.php on line 33
PHP Stack trace:
PHP   1. {main}() /vagrant/website/artisan:0
PHP   2. Illuminate\Foundation\Console\Kernel->handle() /vagrant/website/artisan:36
PHP   3. Symfony\Component\Console\Application->run() /vagrant/website/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122
PHP   4. Symfony\Component\Console\Application->doRun() /vagrant/website/vendor/symfony/console/Application.php:125
PHP   5. Symfony\Component\Console\Application->doRunCommand() /vagrant/website/vendor/symfony/console/Application.php:224
PHP   6. Illuminate\Console\Command->run() /vagrant/website/vendor/symfony/console/Application.php:888
PHP   7. Symfony\Component\Console\Command\Command->run() /vagrant/website/vendor/laravel/framework/src/Illuminate/Console/Command.php:168
PHP   8. Illuminate\Console\Command->execute() /vagrant/website/vendor/symfony/console/Command/Command.php:262
PHP   9. Illuminate\Container\Container->call() /vagrant/website/vendor/laravel/framework/src/Illuminate/Console/Command.php:182
PHP  10. Illuminate\Container\BoundMethod::call() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/Container.php:539
PHP  11. Illuminate\Container\BoundMethod::callBoundMethod() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
PHP  12. Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
PHP  13. call_user_func_array:{/vagrant/website/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:30}() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:30
PHP  14. Ajthinking\Tinx\TinxCommand->handle() /vagrant/website/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:30
PHP  15. Ajthinking\Tinx\TinxCommand->createTinxIncludes() /vagrant/website/vendor/ajthinking/tinx/src/TinxCommand.php:51
PHP  16. spl_autoload_call() /vagrant/website/vendor/ajthinking/tinx/src/TinxCommand.php:71
PHP  17. Composer\Autoload\ClassLoader->loadClass() /vagrant/website/vendor/ajthinking/tinx/src/TinxCommand.php:71
PHP  18. Composer\Autoload\includeFile() /vagrant/website/vendor/composer/ClassLoader.php:322

  [Symfony\Component\Debug\Exception\FatalErrorException]  
  syntax error, unexpected 'for' (T_FOR)                   

I give up on trying to install the library, it doesn't provide so much profit to mess for so long. Still, thanks for effort, m.b. another day will try it again.

furey commented 6 years ago

Hi @metamaker,

Thanks for taking the time to try Tinx, and sorry it didn't install without issue.

I'd love to help you get it working and in the process potentially help others with the same issue.

If you have the time, and I appreciate that you may not, could you please provide:

• Your PHP version (php -v) • Your operating system and version (Mac? Windows? etc)

I'll spin up a virtual machine to try and get to the bottom of the problem ASAP.

Cheers!

dmytro-y-dev commented 6 years ago

Linux debian/stretch amd64 php v5.6

composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "5.6.x",
        "ajthinking/tinx": "0.8.3",
        "cocur/slugify": "^3.0",
        "intervention/image": "^2.4",
        "laravel/framework": "^5.4",
        "laravel/passport": "^4.0",
        "spatie/laravel-fractal": "^4.3",
        "thunderer/shortcode": "^0.6.5",
        "webpatser/laravel-uuid": "2.*"
    },
    "require-dev": {
        "laravel/tinker": "~1.0",
        "barryvdh/laravel-debugbar": "^2.4",
        "barryvdh/laravel-ide-helper": "^2.4",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:meta",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:meta",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}
furey commented 6 years ago

Hi @metamaker,

Thanks for providing that extra information – I really appreciate it.

We've just released v2.0.2 which should patch the issue (backwards incompatible PHP 7.0 syntax).

If you have the time, can you please update to 2.0.2 and let me know how you go?

Cheers!

🤓🤞

furey commented 6 years ago

Closing due to inactivity…

@metamaker Please submit a new issue if our latest release (at the time of writing, v2.0.5) doesn't solve your installation problems.

mfn commented 6 years ago

I just had the same problem as OP, my issue was:

I simply removed the file, then ran ./artisan tinx and it worked (ofc it also worked when I manually added the Provider to config/app.php.

This was with PHP 7.1.x, Laravel 5.5.x, etc.

Fun fact: I tried to reproduce it, and couldn't:

This time it worked.

Literally no idea why the cache file was touched but not properly updated the first time 🤷‍♀️

furey commented 6 years ago

Hey @mfn!

Thanks for taking the time to share your experience.

Updating a Laravel 5.4 project to 5.5 a while back, I experienced similar issues with package cache and auto-discovery, but haven't seen those kind of issues again since.

Happy to hear you got Tinx working!

🤓👍