-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add php install/uninstall script #87
Conversation
c7fddf7
to
80845e2
Compare
80845e2
to
594b861
Compare
They're using Mise to install Node, Ruby, and Go, can we just use that instead? I've been using ASDF for ages myself, so Mise should just work. It should automatically install Composer too. IMO, the PHP setup should be similar to what they did for Go here. So:
Now, we might need some extra stuff for Laravel, though. The PHP extras are too verbose for my taste and it doesn't seem to cover Blade (Laravel's template engine syntax). |
I don't see any php docs for Mise. I've been developping for 10 years in PHP and I agree I could add the lazyvim extras + vscode. I use phpstorm, in my PHP/Symfony circles this seems to be the default, so I'm not very familiar with other IDE / editors. I have a personal fork with PhpStorm configured but I figure it's maybe too much here |
Mise seems to rely on ASDF plugins, so we might be able to Omakub seems to be either Neovim or VSCode, so other IDEs would have to be installed separately. It's about getting a good experience out of the box with Neovim and VSCode for PHP development too (for the mainstream frameworks, like Laravel and Symfony). |
The asdf package for php doesn't seem very active to me. When trying to install with mise I get this error output:
Honnestly this really feels like shoehorning a mediocre solution that isn't quite needed: PHP installs perfectly fine with apt packages, that's how servers are configured, that's how Dockerfiles are configured...why try to force Mise ? As for the editor I totally undestand that vscode and neovim are to be preferred, that's why I'm not including phpstorm here |
I just switched from ASDF to Mise here, looks like it works: mise use -y -g [email protected] But I had it installed via ASDF, so I guess I had all the dependencies installed already (here, as mentioned in the docs). |
Yeah I'd also +1 opting to use mise over apt given it's what is being used for the other languages (Ruby, Node, and Go ) For extras specific to Laravel, aside from adding From tree-sitter-blade discussion
However since I think we're aiming at keeping config low, we may be able to upstreaming to LazyVim, since it looks like the extras for php has been added recently. |
The composer install will stop working if there is a new version.
|
The installation should also include composer bin directory path so that the globally installed CLI apps work. composer global require laravel/installer I.e. this package would make the |
It already does. I tested Laravel and Symfony with sucess. Only the php version should be added. |
Will definitely review in the morning ET. |
d56c0e2
to
c3f0e14
Compare
Updated sqlite extension name Added uninstall script Removed ppa for PHP as 24.04 is already at latest Updated composer install script Added back ondrej/ppa and fixed uninstaller Revert back to using ondrej/php
c3f0e14
to
4bffcbe
Compare
I squashed all commits into one. With this we have the minimal setup for any PHP project, without opiniated choice regarding Symfony / Laravel. |
@roelandmoors I was referring about having this line in export PATH="$PATH:$HOME/.config/composer/vendor/bin" Or this one in export PATH=~/.composer/vendor/bin:$PATH I don't understand how globally installed composer CLI packages would work without having composer's directory in path. And the Symfony CLI you mentioned wouldn't qualify for this test, as it can't be installed via Composer. (unlike Laravel, thus check the the previous |
I do believe we need to add the composer bin to PATH. |
It is already moved to I tested an earlier version of this PR so maybe I'm wrong, but this seems enough te me? |
@roelandmoors but that's the composer installation itself, not adding vendor/bin to PATH (different thing) |
Yes. We need the composer executable it self, the .phar file, in After that we need to add Now we can do all of this:
|
I should have included this but I guess this means something like
|
Sorry, you are correct. The first PR version also installed the Symfony cli and moved it to a different path. |
yeah composer is already in the shell path. composer bin, on the other hand, should not be included by default IMO. But that's a matter of preference. I can add that line @csfh if you think it's useful. |
Hey. I'm not sure why not add it but I would like to hear why you think not be included. It's not up to me at all, but very interesting discussion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can proceed?
Leave it up to the user how they want to manage composer and global composer installations, such as the laravel command.
When we build out the documentation, steps such as the ones we discussed about adding composer global bin dir to $PATH can be added there.
I would rather leave the $PATH clear of this on install especially when we're in the middle of tens of other installs. I don't really use global composer so didn't think about using it. I agree it could be documented for the php docs here |
Great work here! Can someone give me a short playbook on the steps I'd have to take with this setup to get "hello world" in Laravel? |
After you've install PHP using this script, you should be able to run When done, you can cd into example-app and run If you end up using the Laravel installer script instead of the composer-create hook, it'll give you a better and interactive setup and installation guide. For your convenience: https://laravel.com/docs/11.x#creating-a-laravel-project |
I think Laravel is a bit more like Rails, bit if you would like to test Symfony, you can download the cli like this:
After that command you get instructions on how to run the Symfony binary or you can just run it like this You can then create a complete web app (with importmap/stimulus/turbo as default) like this: Inside the my_project folder you can start |
Great. I changed this to run inside the new select-dev-env script, but otherwise left all the same. Tested getting a Laravel hello world. Excellent! Would be nice to get PHP properly supported by mise, though. This just hardcodes PHP 8.3. |
Thanks for merging 😃 For symfony the symfony cli, although very useful, is not required, you can do pretty much the same as for laravel to get a hello world.
As for mise, I discovered it with this project, will try to look at it. I've heard more about nix than for mise for setting up PHP envs. |
Fixes #73
[RFC: bonus] install the symfony binaryAccording to Laravel docs, the initial setup has all tools included (namely the
artisan
console). I'm not Laravel dev so I can't guarantee it's sufficient.