Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

julian2020's avatar

Where to edit Spark source files?

Hi,

for one of my projects I want to disable the automatic team photo cropping to 300x300px. I found the corresponding method call in /spark/src/Interactions/Settings/Teams/UpdateTeamPhoto.php:

// return (string) $this->images->make($file->path())->fit(300)->encode();
return (string) $this->images->make($file->path())->encode();

I course I should not update the file in this location, but I honestly have no idea where to change. There is another match in the vendor directory, which is also a bad thing.

Could you please help me what to do? Do I need to copy the file?

Thanks in advance! Julian

0 likes
4 replies
richard's avatar

From Sparks Terms of Service user the Software Modification section

You may alter, modify, or extend the Software for your own use, or commission a third-party to perform modifications for you, but you may not resell, redistribute or transfer the modified or derivative version without prior written consent from Laravel LLC.

You can copy the entire files and make modifications to suit your use case.

julian2020's avatar

Thank you for the quotation. Do you know if there is any other possibility to disable the image cropping? And to which location do I need to copy the file in order to replace the one in the source directory?

Cronix's avatar
Cronix
Best Answer
Level 67

In Sparks service provider, in the register() method - just register/bind your own class to replace the native one.

$this->app->singleton(
    // when this native Spark class is called
    'Laravel\Spark\Contracts\Interactions\Settings\Profile\UpdateContactInformation',

    // give this class instead
    'App\SparkExtensions\UpdateContactInformation'
);

https://laravel.com/docs/5.8/container#binding

Just copy the original file to a new location and edit it how you need, and instruct Laravel to use your custom class instead. Then you haven't touched the original class and Spark will update normally without overriding your custom changes.

1 like
julian2020's avatar

Thank you Cronix, that was excatly what I searched for!

Please or to participate in this conversation.