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

trimFilePaths feature #26

Merged
merged 7 commits into from
Nov 18, 2024
Merged

Conversation

jackbayliss
Copy link
Contributor

@jackbayliss jackbayliss commented Nov 15, 2024

I'm using this package to display something like :

select * from `foo` limit 100; 0.35ms [edit in /var/www/vhosts/jack/app/Http/Controllers/FooController.php:15

I'm having to trim the file property to remove the application path, ie in the above case /var/www/vhosts/jack

I thought it would be worth trying to add it to the package itself, so that you could do something along the lines of: Backtrace::create()->applicationPath(__DIR__)->trimFilePaths()->frames()) - then you can access the trimmedFile property to access it. and if no application path is provided, it will just be null.

I wanted to do this directly on the file property, but it was being used here - hence why I added a new property.

There might be a better way - so open to suggestions, If you don't think it's worth it no problem.

@jackbayliss jackbayliss marked this pull request as ready for review November 15, 2024 14:46
src/Backtrace.php Outdated Show resolved Hide resolved
@freekmurze
Copy link
Member

Some of the tests are failing. Could you please take a look?

@freekmurze freekmurze merged commit c5ca87a into spatie:main Nov 18, 2024
21 checks passed
@freekmurze
Copy link
Member

Thanks!

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 this pull request may close these issues.

2 participants