Download the PHP package morphql/morphql-symfony without Composer
On this page you can find all versions of the php package morphql/morphql-symfony. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download morphql/morphql-symfony
More information about morphql/morphql-symfony
Files in morphql/morphql-symfony
Package morphql-symfony
Short Description Symfony integration for MorphQL — YAML config, autowiring, and .morphql file convention
License MIT
Homepage https://github.com/Hyperwindmill/morphql-symfony
Informations about the package morphql-symfony
MorphQL Symfony
Symfony integration for MorphQL — transform data with declarative queries.
YAML configuration · Autowiring · Twig-style file convention · PHP 8.1+
Installation
With Symfony Flex (Currently waiting for submission to symfony/recipes-contrib), this will automatically:
- Registers
MorphQLBundleinbundles.php - Creates
config/packages/morphql.yamlwith sensible defaults - Scaffolds the
morphql-queries/directory at your project root
Without Flex, you could have to register the bundle manually in
config/bundles.php(depends on your Symfony version):
The bundle is fully zero-config. All settings have sensible defaults — no YAML file is needed to get started. Just install, drop a .morphql file in morphql-queries/, and you're ready to go.
Configuration (optional)
To customize behavior, create or edit config/packages/morphql.yaml:
All options have sensible defaults — zero-config works out of the box.
Full Configuration Reference
| Option | Default | Description |
|---|---|---|
provider |
cli |
cli (bundled Node.js) or server (remote REST API) |
cli_path |
(auto) | Override CLI binary path |
node_path |
node |
Path to Node.js binary |
cache_dir |
%kernel.cache_dir%/morphql |
Compiled query cache |
query_dir |
%kernel.project_dir%/morphql-queries |
.morphql file directory |
server_url |
http://localhost:3000 |
MorphQL server URL |
api_key |
— | API key for server auth |
timeout |
30 |
Execution timeout (seconds) |
Usage
1. The morphql-queries/ directory
Like Twig templates in templates/, you can store your MorphQL queries in morphql-queries/. Use the .morphql extension for syntax highlighting in supported IDEs.
2. Using the Transformation Registry
Inject the TransformationRegistry to run queries stored in files:
3. Direct MorphQL usage
For ad-hoc queries, you can inject the base MorphQL service:
Features
- Symfony Flex Recipe: Automatic bundle registration, config scaffolding, and query directory creation.
- Filesystem Discovery: Use standard paths like
'sub/folder/query'— no dot-notation required. - Pre-configured: The
MorphQLservice is automatically configured from your YAML settings. - Isomorphic: Switch between
cliandserverproviders via config without changing your code.
Symfony Flex Recipe
The recipe files are staged in the symfony/recipes-contrib for Flex to pick them up automatically.
To submit the recipe:
- Fork symfony/recipes-contrib
- Create
morphql/morphql-symfony/0.1/in the fork - Copy the contents of
recipe/into that directory - Open a Pull Request following the recipe contribution guide
Until the recipe is accepted, users can manually:
- Create
config/packages/morphql.yaml(copy fromrecipe/config/packages/morphql.yaml) - Create the
morphql-queries/directory at their project root
Troubleshooting
"node" not found
If you use a version manager like NVM, asdf, or Volta, the node binary might not be in the default PATH used by your web server or PHP process.
Solution 1: Set the path in .env
Solution 2: Create a system symlink
Prerequisites
- PHP 8.1+
- Node.js 18+ (for the
cliprovider) - Symfony 5.4+, 6.x, 7.x, or 8.x
License
MIT
All versions of morphql-symfony with dependencies
morphql/morphql Version *
symfony/framework-bundle Version ^5.4 || ^6.0 || ^7.0 || ^8.0
symfony/config Version ^5.4 || ^6.0 || ^7.0 || ^8.0
symfony/dependency-injection Version ^5.4 || ^6.0 || ^7.0 || ^8.0