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.

What this package provides

Application modules (e.g. a demo under src/modules/) only need to declare their domain operations with #[AsPayload] + #[ExposeAsGraphql]. The interactive runner page, demo handlers, and any application-specific schema authoring stay in the application — the package owns transport and runtime, the application owns the schema content. Playground does not own the GraphQL HTTP route.

The interactive demo at GET /graphql-showcase (lives in Playground, not here) walks a developer through four real surfaces: the package's POST /graphql runner, the Resource DTO multi-profile route at /playground/customers/{id} (JSON / JSON-LD / GraphQL response), ?include= lazy relation expansion, and the ?query= selection-set bridge. All four sections fire real HTTP — none are mocked.

Configuring the route path

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

This is the same env::VAR::default format the framework already uses for any #[AsPayload] route — EnvValueResolver substitutes the value during route discovery, and falls back to the inline default when the variable is unset. See packages/semitexa-core/docs/PAYLOAD_ENV_ROUTE_OVERRIDES.md 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 #[AsPayload]:

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 required GraphQL field name (e.g. articles, createArticle).
rootType string 'query' 'query' or 'mutation'.
output ?string null FQCN of the typed output DTO (e.g. Article::class). When null, the field's output type is the catch-all Json scalar.
description string '' Schema description (surfaces in introspection).
list bool false When true, the schema field type is wrapped as [Output].

Argument mapping

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

Output mapping

For each 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:

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 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

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 *
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 ...