Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Fsockopen Laravel Package

yakeing/php_fsockopen

yakeing/php_fsockopen is a lightweight PHP wrapper around fsockopen for low-level socket and HTTP connections. It provides a simple way to open sockets, send requests, and read responses without cURL, making it useful for small integrations or environments where cURL isn't available.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

Feature-level: unblocking network integrations without an engineering epic. This package is a thin, opinionated wrapper around PHP's native fsockopen/socket primitives, adding uniform support for tcp://, udp://, unix://, and udg:// endpoints. That maps directly onto a recurring class of roadmap items that are small in user-visible scope but disproportionate in engineering friction:

  • Outbound notification and telemetry channels — emitting metrics to StatsD (UDP), shipping logs to a syslog daemon (UDP/unix), or pinging webhooks over raw TCP when an HTTP client is overkill.
  • Health checks and service probes — a port/daemon reachability check for an admin dashboard, status page, or deployment gate. The unix:// support is particularly relevant for probing local daemons (PHP-FPM status sockets, Redis/MySQL over unix sockets, container runtime sockets) that HTTP clients cannot reach.
  • Custom or binary protocol clients — talking to an internal service, appliance, or third-party API that speaks something line-oriented or binary over TCP rather than REST. This is the classic "we need one integration, not a framework" scenario.
  • Local IPC — unix:///udg:// for inter-process messaging on a single host, useful in single-node deployments and CLI tooling before you invest in a message broker.
  • Prototyping and technical spikes — a fast way to prove a protocol integration is viable in a discovery sprint, then throw the code away or replace it.

Build vs. buy (really: adopt vs. write in-house). The honest framing is that this is not a buy decision. It is roughly a few hundred lines of code wrapping functions PHP already ships. The real choice is between: (a) taking the dependency, (b) copying the pattern into an internal helper class, or (c) adopting a proper async networking stack. For a Laravel codebase, a small internal SocketClient service — testable, mockable, PSR-compatible, and under your own maintenance — is usually the highest-value outcome, with this package as a reference implementation.

Roadmap signal. The existence of this gap tells you something useful: your team has recurring low-level networking needs that the framework does not cover. If more than two or three of the use cases above appear on the roadmap, that is a signal to standardise on a maintained abstraction (ReactPHP's socket component, Amp, or Symfony's HttpClient/Mime where applicable) rather than accumulating one-off fsockopen calls — which become a genuine reliability and testability liability at scale.

Explicitly not supported: async/concurrent I/O, connection pooling, automatic reconnection/backoff, TLS certificate management, HTTP semantics, or protocol framing. If a feature requires any of those, this package is the wrong foundation and the decision should be scoped upward.

When to Consider This Package

Consider it when all of the following hold:

  • You need synchronous, blocking, one-shot socket communication — a probe, a single datagram, a short request/response — not a long-lived connection or a throughput path.
  • The requirement is internal tooling or a prototype, where a short lifespan or low blast radius limits the cost of the dependency going stale.
  • You specifically need unix:// / udg:// support, which is the package's most differentiated convenience and the thing most HTTP abstractions cannot do.
  • Your codebase can tolerate a 2019-era, PHP 7-targeted library — meaning you have verified PHP 8.x compatibility in a real environment, including any removed or deprecated syntax, before committing.
  • MPL-2.0 is acceptable to your legal posture: it is file-level copyleft, so it is generally fine to depend on unmodified in a proprietary product, but you take on obligations if you modify and redistribute the package files. Track any forks deliberately.
  • You accept no vendor support and no security patching — the repository is archived, with the last release in August 2019 and a modest 53 stars, meaning effectively zero community backstop.

Look elsewhere when:

  • The feature is production-critical or customer-facing. An archived, unmaintained dependency in a network path is a latent incident — no CVE response, no PHP-version follow-through.
  • You need concurrency, high connection counts, or low latency — go to ReactPHP (react/socket), Amp v3, or Swoole/OpenSwoole. These are actively maintained and purpose-built.
  • You need TLS properly handled — certificate verification, SNI, cipher control. Use curl, openssl, or a modern HTTP client rather than hand-rolled fsockopen with ssl://.
  • You are actually making HTTP calls — use Laravel's HTTP client, Guzzle, or symfony/http-client. Do not build HTTP on raw sockets.
  • Security review capacity is thin. Raw sockets bypass the guardrails of higher-level clients (redirect policy, timeouts, header handling, SSRF protection). Anything user-influenced feeding a host/port needs validation and an allowlist, and that review burden sits with you.
  • Testability matters. Blocking sockets are painful to unit test; if you need deterministic CI, an injectable, mockable abstraction is a prerequisite.

Decision rule of thumb: use it as reading material or a spike, and write or adopt a maintained abstraction for anything that ships. If it does ship, vendor it into your own namespace, pin it explicitly, add a compatibility test, and note it on a technical-debt register with a named owner and a review date.

How to Pitch It (Stakeholders)

For executives — 30 seconds. This is a small, free utility that lets us talk to internal services and probes over raw network connections without an engineering project. It is not a platform decision. The catch is that it is no longer maintained — last release 2019 — so my recommendation is to use it as a reference for a small in-house helper we own, not as a long-term dependency. Cost to replace: roughly one to two engineering days. Risk of adopting it directly: low today, rising with every PHP upgrade and every quarter it goes unpatched.

For engineering leadership. A thin fsockopen wrapper covering TCP, UDP, and Unix-domain sockets. Genuine value is the uniform interface and unix:// support; everything underneath is native PHP. It buys us roughly a day on a prototype and costs us a dependency we cannot patch. Recommended posture: mine it, don't marry it — copy the pattern into a PSR-compatible, DI-injectable internal client with timeouts, allowlisting, and a mocked transport for tests. If we find three or more such integrations on the roadmap, that is our cue to standardise on ReactPHP or Amp instead of growing a pile of blocking socket calls.

For the product/feature team. It unblocks things like service health checks, UDP metrics emission, syslog shipping, and talking to local daemons over Unix sockets — capabilities our HTTP tooling does not cover. It does not give us async, retries, connection pooling, or TLS handling; any feature needing those should be scoped as a separate, larger piece of work rather than assumed to be cheap.

For legal/compliance. MPL-2.0 — file-level copyleft, permissive enough for proprietary use as an unmodified dependency; obligations attach only if we modify and redistribute the package's own files. Flag the archived status and the 2019 vintage in the dependency register, and prefer an internal reimplementation if the licence question is at all distracting.

The one-line ask. Approve a timeboxed spike (1–2 days) to validate the pattern against our real protocol needs; default outcome is an internal helper we maintain, with this package credited as the reference and not shipped as a runtime dependency.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource