Asked  7 Months ago    Answers:  5   Viewed   81 times

I have installed Laravel using composer without problems, but when I try to execute "laravel" in my terminal I have this typical error:

-bash: laravel: command not found

If I read the documentation of the official site I need to do that:

Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal.

But I don't know how to do (I'm new on terminal console commands).

Can you help me with that? Thanks!!

 Answers

94

Ok, I did that and it works:

nano ~/.bash_profile 

And paste

export PATH=~/.composer/vendor/bin:$PATH

do source ~/.bash_profile and enjoy ;)

Important: If you want to know the difference between bash_profile and bashrc please check this link

Note: For Ubuntu 16.04 running laravel 5.1, the path is: ~/.config/composer/vendor/bin

On other platforms: To check where your Composer global directory is, run composer global about. Add /vendor/bin to the directory that gets listed after "Changed current directory to ..." to get the path you should add to your PATH.

Wednesday, March 31, 2021
 
ALH
answered 7 Months ago
ALH
61

Putting a

<?php xdebug_break(); ?>

into your blade file works pretty well. Even in my tests, PHPstorm jumps to the next PHP statement in some cases.

Why this works:

Laravel processes the blade file to a normal PHP file in the cache folder. But the PHP statement xdebug_break(); will be transferred there and cause the program to halt at the position you want it to (in the cache file).

Wednesday, March 31, 2021
 
employeegts
answered 7 Months ago
83
sudo apt-get install php5-dev

phpize is a tool used to prepare a php module for building, so you'll need the dev package. There shouldn't be any problems, assuming you're using a packaged version of PHP anyway.

(Update - for more recent versions of Ubuntu try sudo apt-get install php-dev)

Saturday, May 29, 2021
 
Crontab
answered 5 Months ago
51

Whenever you install XAMPP, you get all of the Apache, MySQL, PHP stack. The problem is, XAMPP won't link binaries to your PATH, because your could have another version of that software already installed.

Composer needs a PHP version available on your PATH, so the easier option is to link your already installed version of PHP.

I think you can find your PHP binary in /opt/lamp/bin so you can link it this way:

sudo ln -s /opt/llamp/bin/php /usr/bin/php

Hope it works!

If you want to double check your PHP binary location you can go to files then at the end you can find "other locations" click it and then go and check it.

Saturday, May 29, 2021
 
rypskar
answered 5 Months ago
18

The thing is you cannot do this in setUpBeforeClass, because many things are run in setUp method. If you look at this order of run you will see setUpBeforeClass is run before setUp method and TestCase class is doing many things in the setUp method. It looks like this:

protected function setUp()
{
    if (! $this->app) {
        $this->refreshApplication();
    }

    $this->setUpTraits();

    foreach ($this->afterApplicationCreatedCallbacks as $callback) {
        call_user_func($callback);
    }

    Facade::clearResolvedInstances();

    Model::setEventDispatcher($this->app['events']);

    $this->setUpHasRun = true;
}

So what you should do is creating own setUp and tearDown methods with your own implementation like this:

protected function setUp()
{
   parent::setUp();
   // your code goes here
}

protected function tearDown()
{
   parent::tearDown();
   // your code goes here
}
Tuesday, September 28, 2021
 
ioleo
answered 3 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :