Download the PHP package semitexa/graphql without Composer

On this page you can find all versions of the php package semitexa/graphql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package graphql

Semitexa GraphQL

A real, executable GraphQL runtime for Semitexa applications. Built on the same Payload DTO → Handler → Resource architecture as the rest of the framework. Powered by webonyx/graphql-php under the hood, kept behind Semitexa-owned contracts so webonyx types do not leak across the codebase.

Install

Not included by the installer. Add it to an existing project from the project root:

What this package provides

Application modules (e.g. a demo under src/modules/) only need to declare their domain operations with a payload attribute (#[AsPublicPayload], or #[AsProtectedPayload] from semitexa/authorization) plus #[ExposeAsGraphql]. Demo handlers and any application-specific schema authoring stay in the application — the package owns transport and runtime, the application owns the schema content.

Configuring the route path

The default route is POST /graphql. The path argument on GraphqlEndpointPayload's #[AsPublicPayload] uses Semitexa's standard env-driven attribute-value syntax:

This is the same env::VAR::default format the framework already uses for any payload route — EnvValueResolver substitutes the value during route discovery, and falls back to the inline default when the variable is unset. See https://semitexa.com/docs/routing/env-route-override for the framework-wide reference.

To customise the public route in a deployment, set SEMITEXA_GRAPHQL_ROUTE_PATH in .env (or in the process environment). Common values:

Leave the variable unset (or commented) to keep the default /graphql. Verify the registered route at any time with bin/semitexa routes:list | grep graphql.

How Payload → Handler → Resource is preserved

Resolvers in this package are intentionally thin. For each #[ExposeAsGraphql] field, the resolver:

  1. takes the GraphQL arguments,
  2. hydrates a fresh instance of the Payload DTO via setters (PayloadHydratorInterface); each setter validates its argument and may throw Semitexa\Core\Exception\ValidationException, which surfaces as a VALIDATION_FAILED GraphQL error,
  3. resolves the bound Handler from the application container, including its #[InjectAsReadonly] dependencies (HandlerInvokerInterface),
  4. instantiates the Resource declared by the route,
  5. invokes Handler::handle($payload, $resource),
  6. serializes the returned Resource for GraphQL (ResourceSerializerInterface).

Business logic stays in Handlers. The GraphQL layer is a transport.

Exposing a Semitexa operation as GraphQL

Add #[ExposeAsGraphql] to any Payload DTO that already has a payload attribute such as #[AsPublicPayload]:

That's all that's required. Discovery picks it up at boot, the schema builder produces a [Article] field on the root Query type, and the existing ArticleListQueryHandler (declared via #[AsPayloadHandler(payload: …, resource: …)]) runs at field resolution.

Attribute reference

Argument Type Default Meaning
field ?string null GraphQL field name (e.g. articles, createArticle). When null, derived from the Payload class name.
rootType ?string null 'query', 'mutation' or 'subscription'. When null, derived from the HTTP method (GET/HEAD → query, otherwise mutation); subscription must be declared.
output ?string null Legacy: FQCN of an output DTO. The field type normally comes from the route's responseWith resource (#[ResourceObject]), the same contract OpenAPI uses; output is used only when that resource yields no GraphQL fields, and the Json scalar is the last resort.
list bool false When true, the schema field type is wrapped as [Output].
watchScopes list [] Resource scopes a subscription watches; ignored for query/mutation.
description ?string null Schema description (surfaces in introspection).

The attribute is repeatable: one Payload can be exposed as several operations (e.g. a query and a subscription).

Argument mapping

Each public function setX(<scalar>): void setter on the Payload becomes one GraphQL argument named x.

Output mapping

The field type is built from the route's #[ResourceObject] response (or, as a legacy fallback, from the output: class):

The Resource serializer reads the Resource's render context. The convention is: prefer the data key when present (matches every JSON Resource in the framework), otherwise return the whole render context. This makes existing Handlers work without changes — the same Resource you serve over REST renders correctly under GraphQL.

How to run the endpoint

Start the application (bin/semitexa server:start) and POST to /graphql (9502 is the default port; the installer writes the actual one to .env as SWOOLE_PORT):

The response shape is the standard GraphQL-over-HTTP envelope:

Or, on failure:

How errors are shaped

Errors carry a stable extensions.code. Mapping table:

Trigger extensions.code HTTP echo
GraphQL parse / validation failure GRAPHQL_VALIDATION n/a
Semitexa\Core\Exception\ValidationException VALIDATION_FAILED 422
Semitexa\Core\Exception\NotFoundException NOT_FOUND 404
Semitexa\Core\Exception\AccessDeniedException FORBIDDEN 403
Semitexa\Core\Exception\AuthenticationException UNAUTHENTICATED 401
Semitexa\Core\Exception\RateLimitException RATE_LIMITED 429
any other Semitexa\Core\Exception\DomainException with a status below 500 its own error code, upper-cased its own status
any other Throwable INTERNAL_SERVER_ERROR 500

The runtime never leaks original exception messages or stack traces for INTERNAL_SERVER_ERROR — the response carries a generic message.

HTTP status conventions

The endpoint always returns 200 OK for executed-but-failed operations (errors live in the response body — the GraphQL way). Pre-execution shape failures (missing query, malformed JSON) flow through Core's regular validation pipeline and surface as 422/400.

Current limitations

Running the tests

In the Semitexa workspace (where packages/semitexa-graphql is checked out), run the package's PHPUnit tests inside the app container:

Tests cover: attribute behaviour, registry discovery, scalar mapping, schema generation, payload hydration, handler dispatch, resource serialization, error mapping, and end-to-end query/mutation execution against the demo Article domain.


All versions of graphql with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
semitexa/core Version >=2026.10.29.1052 || dev-master
webonyx/graphql-php Version ^15.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package semitexa/graphql contains the following files

Loading the files please wait ...