Skip to content
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

Create PHAR with prefixes to avoid class and package version conflicts #177

Closed
soullivaneuh opened this issue Nov 29, 2017 · 30 comments · Fixed by #465
Closed

Create PHAR with prefixes to avoid class and package version conflicts #177

soullivaneuh opened this issue Nov 29, 2017 · 30 comments · Fixed by #465
Assignees

Comments

@soullivaneuh
Copy link
Contributor

Is a .phar build planned for this tool? I would be interested. :-)

@TomasVotruba
Copy link
Member

Why not :)

I like this approach: https://github.com/phpstan/phpstan-shim

@soullivaneuh
Copy link
Contributor Author

Well, as I can have a link for a wget, I'm ok. 😛

@TomasVotruba
Copy link
Member

Let's do this then :) could you prepare such repository and test it?
We can move the repo here afterwards and generate phar to GitHub pagest

@soullivaneuh
Copy link
Contributor Author

Not sure to get time to learn how to build a .phar now. But if nobody does it, I'll do it one time.

About the .phar story. What is the interest of a -shim repository? Why not publish the phar on a website or on the release file instead like php-cs-fixer?

@TomasVotruba
Copy link
Member

I think it's composer update approach. Install and forget.

I never update my phar deps

@TomasVotruba
Copy link
Member

Feel free to re-open with PR or reference to demo repository.
Closing now to keep only valid issues open only

@TomasVotruba
Copy link
Member

Reoped due to: #302 (comment)

@TomasVotruba TomasVotruba reopened this Jan 31, 2018
@TomasVotruba TomasVotruba changed the title PHAR Create PHAR with prefixes to avoid class and package version conflicts Jan 31, 2018
@TomasVotruba TomasVotruba self-assigned this Feb 13, 2018
@TomasVotruba
Copy link
Member

I'm making this priority, since the bin plugin doesn't work as expected

@inverse
Copy link

inverse commented Apr 17, 2018

Once we have phar support could we add this to phive?

@TomasVotruba
Copy link
Member

Sure. The phar is on hold now, I could not make it.
Any help is appreciated

@TomasVotruba
Copy link
Member

@TomasVotruba
Copy link
Member

TomasVotruba commented Apr 28, 2018

As discusses @mssimi over hangouts, think of prefixing only:

@mssimi
Copy link
Contributor

mssimi commented Apr 29, 2018

Tried php-scoper atm I cannot whitelist namespace easily.

humbug/php-scoper#192

Edit: Does not prefix config files either.

@TomasVotruba
Copy link
Member

TomasVotruba commented Apr 29, 2018

I'd consider using it as it cover 80 % cases.

The rest need to be resolve our way:

  • whitelist can be run done with string replace via cli
    • php-scoper: "Rector" => "Prefix123Rector"
    • sed in cli to original state
  • config files prefixing - simple script should handle that

@inverse
Copy link

inverse commented Apr 29, 2018

What issues did you face when creating the phar?

@TomasVotruba
Copy link
Member

TomasVotruba commented Nov 6, 2019

Why/how create the compiler?

Where to start

@ondrejmirtes

This comment was marked as off-topic.

@TomasVotruba
Copy link
Member

I've updated the link.

Btw, how can Rector use PHPStan now without requiring whole prefixed phar? I didn't find https://packagist.org/?query=phpstan-src on packagist :/

@ondrejmirtes

This comment was marked as off-topic.

@TomasVotruba
Copy link
Member

The problem is, most of vendor will be duplicated/prefixed.
To prefix Rector correctly using PHPStan's vendor, we would need to know the prefix string. It's not possible now

@ondrejmirtes

This comment was marked as off-topic.

@TomasVotruba
Copy link
Member

TomasVotruba commented Nov 6, 2019

There is symfony/console in PHPStan - prefixed,
and one in Rector - currently not prefixed.

That means almost double the load of files in vendor compared to shared dependencies - now.

@ondrejmirtes

This comment was marked as off-topic.

@TomasVotruba
Copy link
Member

It is, PHPStan (the .phar with prefixed) + Rector's vendor.
The best solution to keep file load same as now would be to have phpstan-src on Packagist, as was phpstan before.

@ondrejmirtes

This comment was marked as off-topic.

@TomasVotruba
Copy link
Member

Thanks for the link. It looked very random with commit and no PR to master.

Just try it and see that it works. No one cares about 5 more megabytes to download. It's better longterm like this.

I don't mind that much, but not sure about the community. I'll refer people to this if they complain :)

@TomasVotruba
Copy link
Member

TomasVotruba commented Dec 1, 2019

The solution is closer than ever before... :)
#2373

We got to overcome handful Symfony bugs at first, but now it looks good

@TomasVotruba
Copy link
Member

Resolved by #2373

Download and test at https://github.com/rectorphp/rector-prefixed

TomasVotruba added a commit that referenced this issue Jun 8, 2021
rectorphp/rector-src@ca1cdfa [PHP 8.0] Include instant returns in match (#177)
echo511 pushed a commit to echo511/rector that referenced this issue Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants