Ddev: Add support for Laravel (First step: Try it out as PHP)

Created on 31 May 2018  路  19Comments  路  Source: drud/ddev

Is your feature request related to a problem? Please describe.

Laravel doesn't have explicit support in ddev. We should consider adding it.

Describe the solution you'd like
We can template out the config/database.php file with the appropriate credentials added, but this would be a fairly undesirable solution in the laravel community. If you look at that file, it's reading credentials from the environment variables DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, and DB_DATABASE. If we set those environment variables, Laravel should "just work".

We could also write out a .env file (example) with our creds prepopulated.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

actionable

Most helpful comment

I started a new Laravel Project todo..

I just did

$ composer create-project --prefer-dist laravel/laravel software-name "5.8.*"
$ ddev config

And then I was good to go..

https://twitter.com/randyfay/status/1176907118051385349

All 19 comments

+1

Any thoughts about what would make this more attractive than https://laravel.com/docs/5.6/homestead ?

I'd had a look at adding this a year or so ago but ultimately became bearish because we didn't have contacts in the laravel community and homestead exists and looks to be officially supported.

Homestead is a gigantic Vagrant box. Personally, I'm pretty happy with the idea of never installing Virtualbox again :) There's also Laravel Valet, which is another officially supported solution for macos, but I had lots of problems with it.

I think the argument is that agencies will do some WP, some Drupal, and a few Laravel sites. So one platform to manage it all.

I'm first just going to take it for a test ride and document getting it spun up with generic PHP.

Moved to v1.1.0 release since this isn't going to get attention on this round.

Need @alkymst time on this, but I know he's tied up at the moment. Same is true for GravCMS, which we've had at least 3 or 4 requests or inquiries about.

Some updates on "official" Laravel support or is the idea dead?

"Official" support just means customizing settings files and sometimes nginx/apache config. So the reality is it's mighty easy to work with any PHP framework just using the 'php' project type. A few people have done that, but we haven't had a lot of activity here as you can see, so it hasn't made the priority list.

@rfay Can we start to work on it and open a PR or is this task already assigned and planned for a future release?

@unherz PRs are always welcome, but you might want to start by just documenting how to run it, and what's required. A great place to incubate that kind of thing is on Stack Overflow (tagged "ddev" of course). You can make a question and answer it yourself.

Hi all,

Just having a play with this today and Laravel runs just fine under the php option.

Agree it would be nice if ddev could do the scaffolding (setup env file, run key:generate, etc) but its pretty straightforward to do.

Cheers

Tom

Thanks so much for the report @tommym9

BTW, the best path forward for Laravel at this point is just to do a PR explaining how to use it with project type 'php' in github.com/drud/ddev-contrib. Super easy to put that into a PR there, and it will be a great start. If ddev gets any traction in the Laravel community it can be added as a top-level supported framework.

As suggester by rfay, see the answer to "How can I create a laravel 5 dev site with DDEV? here: https://stackoverflow.com/q/57983809/12082358

I started a new Laravel Project todo..

I just did

$ composer create-project --prefer-dist laravel/laravel software-name "5.8.*"
$ ddev config

And then I was good to go..

https://twitter.com/randyfay/status/1176907118051385349

As a +1 to the last comment. The step after is copying the .env.example file to be .env and setting the database credentials. By default they are

DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=db
DB_USERNAME=db
DB_PASSWORD=db

These would change if you set the db credentials to something else in .ddev/docker-compose.yaml

@rfay happy to do a PR for https://github.com/drud/ddev-contrib. Should this be added as a new recipe? Or somewhere else in that repo?

Cheers

Tom

@tommym9 yeah, new recipe would be great over there, like the REDAXO one.

Was this page helpful?
0 / 5 - 0 ratings