Zum Hauptinhalt springen
LIVE
CVSS 6.9CVE-2026-138103 | A vulnerability was detected in ssssssss-team magic-api up to 2.2.2. This issue affects the function saveFile of the file MagicResourceController.java of the component magic-api-core resource save API. The manipulation results in code injection. It is possible to launch the attack remotely. The exploit is now public and may be used. The project was informed of the problem early through an issue report but has not responded yet.CVSS 9.4CVE-2026-138102 | A security vulnerability has been detected in D-Link DIR-620S 4.0.2. This vulnerability affects unknown code of the file /usr/sbin/anweb of the component Diagnostic Handler. The manipulation of the argument I leads to os command injection. It is possible to initiate the attack remotely. The exploit has been disclosed publicly and may be used.CVSS 5.3CVE-2026-138101 | A weakness has been identified in MassGen up to 0.1.97. This affects the function _generate_subagent_yaml_config of the file massgen/subagent/manager.py of the component Subagent Delegation System. Executing a manipulation can lead to improper authorization. The attack may be performed from remote. The exploit has been made available to the public and could be used for attacks. The project was informed of the problem early through an issue report but has notCVSS 6.9CVE-2026-138100 | A security flaw has been discovered in MassGen up to 0.1.97. Affected by this issue is the function __init__ of the file massgen/filesystem_manager/_filesystem_manager.py. Performing a manipulation results in protection mechanism failure. The attack is possible to be carried out remotely. The exploit has been released to the public and may be used for attacks. The project was informed of the problem early through an issue report but has not responded yet.CVSS 8.7CVE-2026-138099 | A vulnerability was identified in Tenda AC10U 1.18.6. Affected by this vulnerability is the function readUsb of the component ATE Service. Such manipulation leads to out-of-bounds write. The attack can be executed remotely. The exploit is publicly available and might be used.CVSS 6.9CVE-2026-138098 | A vulnerability was determined in weison-tech yii2-cms up to 1.0.2. Affected is an unknown function of the file protected/core/config/common.php of the component RBAC Authorization. This manipulation causes improper authorization. Remote exploitation of the attack is possible.CVSS 6.9CVE-2026-138097 | A vulnerability was found in weison-tech yii2-cms up to 1.0.2. This impacts the function isActive of the file AccessControl.php of the component RBAC Admin Module. The manipulation results in missing authorization. The attack may be launched remotely.CVSS 6.9CVE-2026-138096 | A vulnerability has been found in weison-tech yii2-cms up to 1.0.2. This affects an unknown function of the file protected/core/config/web.php of the component Admin Auto-Login Identity Cookie. The manipulation leads to improper authentication. The attack may be initiated remotely.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

The src/ Layout for Hexagonal PHP: Layers and Import Rules

Book: Decoupled PHP — Clean and Hexagonal Architecture for Applications That Outlive the Framework Also by me: Thinking in Go (2-book series) — Complete Guide t…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 7 Min. Lesezeit
Quelle: dev.to
Rubrik: Secure Programming





You read the hexagonal post, you liked the hexagon diagram, and then you opened your editor and made three folders: Domain, Application, Infrastructure. Good start. Two weeks later a use Doctrine\ORM\EntityManagerInterface sits at the top of a domain entity, and nobody remembers approving it. The folders were a suggestion. Nothing stopped the import.



The layout only matters if the boundaries are enforced. This post gives you the concrete src/ tree, the namespace-to-layer map, the exact directions an import is allowed to point, and the CI check that fails the build when someone points one the wrong way. Target is PHP 8.4+ with Composer PSR-4.






The tree



Three top-level namespaces under src/, mapped one-to-one to three directories.




your-app/
composer.json
src/
Domain/ # pure PHP, no vendor imports
Order/
Order.php
OrderId.php
OrderStatus.php
Customer/
Shared/
Money.php
Application/ # use cases + the ports
Order/
PlaceOrder.php
PlaceOrderInput.php
Port/
OrderRepository.php
PaymentGateway.php
Clock.php
Infrastructure/ # adapters, framework, wiring
Persistence/Doctrine/
Http/Controller/
Payment/Stripe/
Clock/SystemClock.php
Bootstrap/Container.php
tests/






Each ring is a layer. Domain is the center. Infrastructure is the outer edge that touches the world. Application sits between, holding the use cases and the interfaces (ports) the use cases depend on.






The namespace map



One PSR-4 root, three sub-namespaces that shadow the directories exactly.




{
"autoload": {
"psr-4": {
"App\\": "src/"
}
}
}






So src/Domain/Order/Order.php is App\Domain\Order\Order, and the first segment after App\ tells you the layer at a glance. No App\Models, no App\Services, no App\Http scattered across the root. The namespace is the architecture. When you read an import, the second segment answers "which ring does this live in" before you read the class name.



Keep the framework's own namespace out of src/. Symfony's App\Controller convention and Laravel's App\Http both flatten everything into one bag. You want the opposite: the layer is load-bearing, so it goes first.






The import rules



Here is the whole architecture in one table. Rows are the file doing the importing; columns are what it is allowed to import.




































From \ imports Domain Application Infrastructure Vendor
Domain yes no no no
Application yes yes no no*
Infrastructure yes yes yes yes


The rule reads in one direction: imports point inward, never outward. Domain imports only itself. Application imports Domain and itself. Infrastructure imports everything, because it is the layer whose whole job is to translate between the outside world and the inside.



The no* on Application-to-vendor has one carve-out worth naming: PSR interfaces (Psr\Log\LoggerInterface, Psr\Clock\ClockInterface) and pure library value types are sometimes allowed there, because they are contracts, not implementations. Decide it once for the team and encode the decision in the CI config below, so it is not re-argued in every review.



Two consequences fall out of the table:




  • A domain entity that needs now() cannot call new DateTimeImmutable() and stay honest — that is a decision from the outside world. It takes the time as an argument, or the use case reads a Clock port. The Clock interface lives in Application\Port; SystemClock lives in Infrastructure.

  • A use case that needs to save an order depends on App\Application\Port\OrderRepository, an interface. The Doctrine class that implements it lives in Infrastructure and is bound at wiring time. The arrow points from Infrastructure inward to the port, which is exactly what the table allows.






Why the direction matters



The point of pointing imports inward is that the center never has a reason to change when the edge does. Swap Doctrine for raw PDO, Guzzle for the Symfony HTTP client, RabbitMQ for SQS — every one of those edits lands in Infrastructure. The Domain and Application files do not move, because nothing in them names the thing you replaced.



A port makes this concrete. The use case states its need in domain language.




<?php

declare(strict_types=1);

namespace App\Application\Port;

use App\Domain\Order\Order;
use App\Domain\Order\OrderId;

interface OrderRepository
{
public function save(Order $order): void;
public function findById(OrderId $id): ?Order;
}






No EntityManager, no QueryBuilder, no SQL. The adapter that satisfies this interface is free to use all three, because it lives on the outside where vendor imports are legal.




<?php

declare(strict_types=1);

namespace App\Infrastructure\Persistence\Doctrine;

use App\Application\Port\OrderRepository;
use App\Domain\Order\Order;
use App\Domain\Order\OrderId;
use Doctrine\ORM\EntityManagerInterface;

final readonly class DoctrineOrderRepository
implements OrderRepository
{
public function __construct(
private EntityManagerInterface $em,
) {}

public function save(Order $order): void
{
$this->em->persist($order);
}

public function findById(OrderId $id): ?Order
{
return $this->em->find(Order::class, $id->value);
}
}






Read the two files together. The use Doctrine\... line is legal here and illegal one folder over. That is the entire discipline, and folders alone will not hold it.






The CI check that enforces it



Nothing above survives contact with a deadline unless a machine rejects the violation. Two tools do this for PHP. Pick one.



Deptrac maps namespaces to layers and declares which layers may depend on which. A deptrac.yaml for this tree:




deptrac:
paths:
- ./src
layers:
- name: Domain
collectors:
- type: directory
value: src/Domain/.*
- name: Application
collectors:
- type: directory
value: src/Application/.*
- name: Infrastructure
collectors:
- type: directory
value: src/Infrastructure/.*
ruleset:
Domain: ~
Application:
- Domain
Infrastructure:
- Domain
- Application






Domain: ~ means the domain may depend on nothing but itself. Run it in the pipeline:




vendor/bin/deptrac analyse --fail-on-uncovered






Any import that crosses a boundary the ruleset forbids exits non-zero and breaks the build. --fail-on-uncovered also catches a namespace you forgot to assign to a layer, so a new top-level folder cannot sneak past unclassified.



PHPArkitect expresses the same rules as fluent PHP assertions if you prefer code over YAML:




Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('App\Domain'))
->should(new NotDependsOnTheseNamespaces(
'App\Application',
'App\Infrastructure',
'Doctrine',
'Symfony',
))
->because('the domain stays framework-free');






If you want a zero-dependency smoke test before adding either tool, a grep in CI catches the loudest offenders:




if grep -rlE \
'use (Doctrine|Symfony|GuzzleHttp|Illuminate)' \
src/Domain src/Application; then
echo "vendor import inside Domain/Application"
exit 1
fi






The grep is blunt. It misses transitive dependencies and the PSR carve-outs, so treat it as a stopgap while you wire up Deptrac. The static tool is the real gate. It reads the actual use graph, not a string match, and it fails the exact pull request that introduced the leak, while the reviewer still remembers the context.






Where to start



If you have an existing app, do not rewrite the tree in one branch. Create the three folders, move one aggregate and its use case inside, add the Deptrac config with only that slice covered, and turn on --fail-on-uncovered. The build starts guarding the boundary you just drew. Every following slice inherits the same gate for free, and the day someone adds use Doctrine to a domain class, the pipeline says no before a human has to.



Keeping the framework at the outer edge is a dependency direction, not a folder convention. The direction only holds when a machine checks it on every push. That inversion, the domain that depends on nothing and the framework that depends on everything, is the spine of what Decoupled PHP builds chapter by chapter: ports, adapters, use cases, and the migration path for a Laravel or Symfony app that has to keep shipping while it moves onto this shape.



Decoupled PHP — Clean and Hexagonal Architecture for Applications That Outlive the Framework



Available on Kindle, Paperback, and Hardcover. English, German, and Japanese editions out now — Portuguese and Spanish coming soon.

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Community discussion & comments

🌐 Join the main chat

Start the discussion in the Social Chat broadcast stream or submit an expert contribution via the supplement form above.

Community Rating &amp; Social Proof
⭐ Reader Rating
–
Ø / 5.0
No reader ratings yet
Was this article helpful?
0
Submit your rating
Detailed rating (optional)
Content & Quality
Source & Credibility
Freshness
Security Briefing Free · 1-Click Unsubscribe

Intelligence Digest — free

The top security news daily · unsubscribe anytime

Related story clusters & sources (vector AI)

6 Cluster
26 sources
ForgeOS Booted on a Real Server: Linux Kernel Below, Only Our Own Code Above
DEV Community 1 hour ago
25 more sources
VulDB Updates2 hours agoCVE-2026-72239 | Linux Kernel sev x86/virt/sev/sev.c wbinvd_on_all_cpus state issue (WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72240 | Linux Kernel up to 7.1.4 mfd sm501_register_device memory leak (WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72241 | Linux Kernel up to 7.1.4 uleds strchr buffer overflow (WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72244 | Linux Kernel up to 6.12.100/6.18.41/7.1.4/7.2-rc2 gpu-buddy allocation of resources (WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72243 | Linux Kernel up to 7.2-rc2 selinux socket_sendmsg permission (Nessus ID 364200 / WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72245 | Linux Kernel up to 7.1.4 host1x host1x_device_parse_dt release of resource (WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72246 | Linux Kernel flowtable input validation (WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72247 | Linux Kernel up to 7.2-rc3 nf_conncount __nf_conncount_add dir comparison (WID-SEC-2026-2852) VulDB Updates2 hours agoCVE-2026-72248 | Linux Kernel up to 7.1.4/7.2-rc2 flowtable nft_flow_dst_release buffer overflow (WID-SEC-2026-2852) LinuxAndUbuntu2 hours agoLinux AutoFDO Benchmark: Clang Kernel Optimization FOSS Linux2 hours agoNFS2ROOT: Pre-Auth Flaw in the Linux NFS Server VulDB Updates3 hours agoCVE-2022-31607 | NVIDIA GPU Display Driver on Linux Kernel Mode Layer nvidia.ko input validation (EUVD-2022-53059 / Nessus ID 339047) VulDB Updates4 hours agoCVE-2026-72227 | Linux Kernel up to 6.12.96/6.18.39/7.1.4/7.2-rc2 batman-adv out-of-bounds (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72228 | Linux Kernel up to 7.2-rc2 batman-adv skb_split memory leak (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72229 | Linux Kernel up to 7.2-rc2 batman-adv register_netdevice memory leak (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72231 | Linux Kernel up to 7.2-rc2 batman-adv batadv_send_tt_request allocation of resources (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72230 | Linux Kernel up to 7.2-rc2 batman-adv batadv_frag_send_packet memory leak (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72232 | Linux Kernel up to 7.2-rc2 batman-adv batadv_interface_tx out-of-bounds (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72234 | Linux Kernel up to 7.2-rc1 batman-adv batadv_get_vid use after free (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72233 | Linux Kernel up to 7.2-rc1 batman-adv batadv_bla_is_backbone_gw use after free (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72236 | Linux Kernel up to 7.2-rc3 s390/perf_cpum_cf __hw_perf_event_init config array index (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72235 | Linux Kernel up to 7.2-rc1 batman-adv batadv_interface_rx use after free (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72237 | Linux Kernel up to 7.2-rc2 BRS /x86/amd/brs amd_brs_match_plm information disclosure (WID-SEC-2026-2852) VulDB Updates4 hours agoCVE-2026-72238 | Linux Kernel up to 7.2-rc3 x86 boot early_serial_init integer overflow (WID-SEC-2026-2852) DEV Community4 hours agoIs that GPTBot real? How to verify Googlebot, Bingbot and AI crawlers in your server logs
14 sources
Amazon Australia Cyber Monday deals
Latest from TechRadar 33 min. ago
13 more sources
CNET43 min. agoThis Pocket Battery Recharges Your Phone 4 Times, and it’s Only $38 for Cyber Monday Latest from TechRadar1 hour agoFirebat's M1 is a cracking Ryzen AI 9 HX 470 mini PC for AI workloads — and it's packing OCuLink, 32GB of RAM, and a 1TB SSD for $1020 this Cyber Monday Latest from TechRadar1 hour agoThe Lenovo IdeaCentre Tower Copilot+ PC with Core Ultra 7 CPU isn't discounted for Cyber Monday — and it's still the desktop computer I'd buy for work for $1049 The Verge1 hour agoQobuz is my streaming service of choice and it’s on sale during Cyber Monday CNET12 days agoThis Paramount Plus Cyber Monday Deal Gets You Ad-Free Viewing for Only $3 Per Month CNET1 hour agoCyber Monday Meta Quest 3S Deal Knocks $53 Off and Gets You $50 Free Amazon Credit WIRED4 hours agoThe 31+ Very Best Amazon Black Friday Deals (2026): Up to 50% Off The Verge2 hours agoThese early Cyber Monday gaming laptop deals offer the most GPU for the least money Latest from TechRadar3 hours agoGrab a TP-Link dual-band Wi-Fi 6 router with 1.5Gbps for $44 this Cyber Monday CNET4 hours agoUpgrade Your Emergency Preparedness Kit With Black Friday and Cyber Monday Deals on Power Stations, Flashlights, Solar and More AppleInsider News4 hours agoAirPods Max 2 plunge to best $399 price with $150 Cyber Monday discount Latest from TechRadar4 hours agoI test Apple TV VPNs for a living — here are the 3 VPNs worth your money for Black Friday and Cyber Monday WIRED4 hours agoCyber Monday Deals, Curated Live By Our Experts (2026)
Similar posts
🔍 Verwandte News

Auch interessante Nachrichten The src/ Layout for Hexagonal PHP: Layers and Import Rules

Thematisch verwandte Begriffe: Layout, Hexagonal, Layers, Import · 6 Treffer

Laden...

Loading videos ...

Laden...

Loading posts ...

Laden...

Loading videos ...

Laden...

Loading posts ...

Laden...

Loading videos ...

Laden...

Loading posts ...

Laden...

Loading videos ...

Laden...

Loading posts ...

Laden...

Loading videos ...

💬 Loading comments…
Pull to refresh
Widgets & topics
Loading widgets…
Next post