PHP Reddit – Telegram
PHP Reddit
34 subscribers
289 photos
37 videos
24.8K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Thoughts on the new Forge?

Had a little look around and it seems like a decent facelift all things considered. It will take some getting used to but I think it looks mostly okay design and feature wise. I'm not a serious Forge user but it seems alright.

I don't really see myself using the Laravel VPS stuff since I prefer European servers and I believe their system uses DigitalOcean underneath it all.

What are your thoughts/opinions about it? :)

https://redd.it/1nvfuak
@r_php
I need forge explained to me in the context of why I’d choose it over a PaaS

In simple terms, I currently use render, I used to use Heroku.

With a paas I have a database, cron jobs, redis all managed and auto scaling.

Why would someone like me move to something like forge. What are the benefits?

https://redd.it/1nvoilr
@r_php
I am creating a microservice framework for PHP using Swoole

Hey all,

I recently discovered Swoole and decided to learn it a bit more so I decided to write a microservice framework that's built on top of Swoole.

This is currently a work in progress but I thought I'd share it to see if I could get some feedback.

https://github.com/Kekke88/Mononoke

Contributions are also welcome, this is my first open source project so things might be a bit unstructured. Any tips and suggestions on this is highly appreciated.

https://redd.it/1nvxjro
@r_php
Plea for help! Does anyone have/know where I could obtain the brandonwamboldt/utilphp package?

Hello!

I've got a very old Dockerised project, for the website of a family member's small business, it was built \~8 years ago with Bolt CMS 3.2, and has basically been ticking along unmaintained since then (if it ain't broke, don't fix it)

A dependency of Bolt is https://packagist.org/packages/brandonwamboldt/utilphp, however at some time in the last year, the author decided to delete the Github repository.

A quirk of the project, I never got to the bottom of why, but every few months the DigitalOcean droplet runs out of disk space, so then I just run docker prune to clear all the volumes and images, and then rebuild everything 😂 (yeah it's amateurish, but it's such a basic website it's never been worth the effort to fix it properly!)

Anyway, today I discover that the project doesn't build because the above Github repository is deleted.

So, I'm posting here to ask if anyone happens to have any version of this package themselves - maybe in their own vendor folder, as a direct or indirect dependency - and if so, perhaps they could kindly share this with me? And then I could somehow work out how to hack things together so that composer recognises my own copy as the package's source.

Or, if anyone knows of a Github archive/mirror that would somehow still have this package available?

Otherwise I'll have to try and upgrade to Bolt 5 - but since a prerequisite is a working project with Bolt 3.7 - I'm not sure how possible this would be.

If anyone can help me they would really be a true lifesaver! Thank you in advance

On a sidenote - packagist says it has 538,490 installs - you hear a lot about this sort of thing happening with npm, where a package owner deletes the project and failing builds ensue - but I naively assumed composer would somehow do something to mitigate this - but I guess composer is just as vulnerable!? (Or even moreso - if I'm not mistaken npm have taken steps to remedy this - I'm not completely in the loop though so I could be wrong)

https://redd.it/1nvxt3s
@r_php
I built a PHP SDK for the Agentic Commerce Protocol (ACP), looking for testers

Hey all,

Three days ago OpenAI + Stripe dropped this new thing called Agentic Commerce Protocol (ACP). Basically it lets people buy stuff directly inside ChatGPT with instant checkout. It’s super new and I was curious, so I spent the last days hacking together a PHP SDK for it.

Repo’s here: https://github.com/shopbridge/shopbridge-php

It handles checkout sessions (create/update/complete/cancel), webhook signatures, product feeds in CSV/JSON/XML, etc. Runs on PHP 7.4+.

This is all open source / MIT. I honestly just want people to try it out, break it, tell me what sucks, or maybe even use it in a test project. Happy to help if you want to play with ACP for your shop or a client.

It’s all very fresh, so don’t expect production-grade yet, but if anyone here is curious, I’d love feedback.

Cheers!

https://redd.it/1nvxfe2
@r_php
Stuck with Laravel Package Tests with Pest + Orchestra Testbench - Laravel Helpers Not Available

## Context

I've developed a Laravel package that works perfectly in production, but I'm struggling to get the tests working properly. The package is located at `packages/cli/` within my Laravel application (local package development setup).

**Goal:** Run my package tests from the Laravel app root using `php artisan test`

**Current Issue:** Tests run but Laravel helper functions like `config()`, `app()`, etc. are not available. I get "Target class [config] does not exist." errors.

## What I've Done So Far

### 1. Installed Required Dependencies

**Package `composer.json`:**
```json
{
"name": "sheaf/cli",
"type": "library",
"autoload": {
"psr-4": {
"Sheaf\\Cli\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Sheaf\\Cli\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Sheaf\\Cli\\ServiceProvider"
]
}
},
"require-dev": {
"orchestra/testbench": "^10.4",
"pestphp/pest": "^3.8",
"pestphp/pest-plugin-laravel": "^3.2"
}
}
```

### 2. Created TestCase with Orchestra Testbench

**`packages/cli/tests/TestCase.php`:**
```php
<?php

namespace Sheaf\Cli\Tests;

use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
{
protected function getPackageProviders($app)
{
return [
\Sheaf\Cli\ServiceProvider::class,
];
}

protected function setUp(): void
{
parent::setUp();
}
}
```

### 3. Created Pest Configuration

**`packages/cli/tests/Pest.php`:**
```php
<?php

declare(strict_types=1);
uses(\Sheaf\Cli\Tests\TestCase::class)->in('Feature', 'Unit');
```

### 4. Created Test File

**`packages/cli/tests/Feature/ExampleTest.php`:**
```php
<?php

namespace Sheaf\Cli\Tests\Feature;

test('confirm environment is set to testing', function () {
expect(config('app.env'))->toBe('testing'); // ERROR HERE
});
```

### 5. Updated Laravel App's `phpunit.xml`

```xml
<testsuites>
<testsuite name="Package">
<directory>packages/cli/tests</directory>
</testsuite>
</testsuites>
```

## The Problem

When I run tests from the Laravel app root with `php artisan test`, I get:

```
Target class [config] does not exist.
```

I added debug code to check what's happening:

```php
test('debug', function () {
dd([
'testcase_class' => get_class($this),
'parent_class' => get_parent_class($this),
'app_exists' => isset($this->app),
]);
});
```

**Output:**
```php
array:3 [
"testcase_class" => "P\Packages\cli\tests\Feature\ExampleTest"
"parent_class" => "PHPUnit\Framework\TestCase"
"app_exists" => false // Laravel app not available
]
```

## What Works

Running tests from **within the package directory** works fine:
```bash
cd packages/cli
./vendor/bin/pest
```

## What Doesn't Work

Running from Laravel app root:
```bash
php artisan test
```

## My Understanding

I believe the issue is that when running tests from the Laravel app root, Pest doesn't discover my package's `Pest.php` configuration file, so it doesn't know to use my custom TestCase.

## What I've Tried

1. Verified autoload-dev has correct namespace with trailing backslash
2. Run `composer dump-autoload` multiple times
3. Cleared Laravel caches
4. Verified Orchestra Testbench is installed
5. Package ServiceProvider loads correctly in the app (commands work)
6. Tried adding `uses(TestCase::class)` in test files (got "uses() undefined")

## Questions

1. **Is this the correct approach for testing local packages within a Laravel app?**
2. **How do I make Pest discover/use my package's TestCase when running from the app root?**
3. **Should I be using a different testing strategy for local packages?**

## Directory Structure

```
my-laravel-app/
├── app/
├── packages/
│ └── cli/
│ ├── src/
│ │ └── ServiceProvider.php
│ ├── tests/
│ │ ├── Pest.php
│ │ ├── TestCase.php
│ │ └── Feature/
│ │ └──
ExampleTest.php
│ ├── composer.json
│ └── phpunit.xml
├── tests/
├── composer.json
└── phpunit.xml
```

## Environment

- Laravel 11
- PHP 8.2
- Pest 3.8
- Orchestra Testbench 10.4

---

## Code source of my package:
https://github.com/sheafui/cli/tree/tests/configuration (within the branch `tests/configuration`)

Any guidance would be greatly appreciated! I've been stuck on this for days and can't figure out what I'm missing.

Thanks in advance! 🙏

https://redd.it/1nwdd6e
@r_php
Using ionCube in Laravel for encrypting source code

Hi -

I'm a Laravel developer (love it), going on 5 years now -

Management has requested we use ionCube... I have had mixed success with ionCube... I get a lot of unresolved class errors, unresolved methods, binding resolution errors (not sure the exact name). Each php file on its own is stand-alone encrypted, so what I do is unencrypt specific files until the errors go away...

I'm not sure if it is related to the types of design patterns Laravel uses -

Does anyone use ionCube to encrypt source code? Do you come across any challenges? How do you solve those challenges in a general sense?

Thanks -

https://redd.it/1nwzfy8
@r_php
is there any reason "Installing Composer Dependencies for Existing Applications" section removed from Laravel 12 sail documentation?

I got a new macbook pro. I decided not to use Laravel valet to keep may Macos clean, And beside that I saw wehn Googling that Laravel valet maybe discontinued in future in favor of Laravel herd. I don't like to use herd, so I decided to go with Laravel sail. but when reading the docs I found out that they removed the "Installing Composer Dependencies for Existing Applications" I was a little concerned if they are discontinuing Laravel sail to in favor of herd? or it's just they forgot to add this se section back into Laravel 12 documentations. Because it does not make sense for someone who wants to use Laravel sail with docker to install PHP and composer too into it's OS. someone like me who decides to use docker is because I don't want to install PHP and Composer. If I install those I would use valet.

https://preview.redd.it/saugkw5dswsf1.png?width=1268&format=png&auto=webp&s=e1750ebbbb2b22d171370c02d535b9d316c5f6b9



https://redd.it/1nx12ad
@r_php