open-index/open-npm huggingface dataset:
npm package: @nx-php/composer-plugin
Description: The Nx PHP Package Plugin is a plugin for an [Nx Workspace](https://nx.dev/) that enables computation of the PHP package graph from `composer.json` `require` and `require-dev` within a monorepo structure. With this plugin, you can integrate PHP packages i
Latest version: 0.2.0

# `@nx-php/composer-plugin`

The Nx PHP Package Plugin is a plugin for an [Nx Workspace](https://nx.dev/) that enables computation of the PHP package graph from `composer.json` `require` and `require-dev` within a monorepo structure. With this plugin, you can integrate PHP packages into your existing Nx workspace without having to manually specify dependencies between your project.

## Getting Started

To start using the `@nx-php/composer-plugin`, follow these steps:

1. Install the plugin as a development dependency in your Nx workspace:

```bash
npm install --save-dev @nx-php/composer-plugin
```

2. Add the plugin to your workspace's `nx.json`

```json
{
    "$schema": "./node_modules/nx/schemas/nx-schema.json",
    "npmScope": "my-project",
    "tasksRunnerOptions": {
        "default": {
            "runner": "nx/tasks-runners/default",
            "options": {
                "cacheableOperations": [
                    "build",
                    "lint",
                    "test",
                    "e2e"
                ]
            }
        }
    },
    "targetDefaults": {
        "build": {
            "dependsOn": [
                "^build"
            ]
        }
    },
    "plugins": [
        "@nx-php/composer-plugin" //This is the important line!
    ]
}
```

3. Start developing your PHP package!

> You will likely need the [`@nx-php/phpunit`](../phpunit-executor/README.md) package in order to test your plugin.
npm package: @nx-php/phpunit
Description: The `@nx-php/phpunit` package is a plugin for an [Nx Workspace](https://nx.dev/) that enables you to build PHP packages within a monorepo. With this package, you can easily integrate PHP packages into your existing Nx workspace.
Latest version: 0.2.0

# `@nx-php/phpunit`

The `@nx-php/phpunit` package is a plugin for an [Nx Workspace](https://nx.dev/) that enables you to build PHP packages within a monorepo. With this package, you can easily integrate PHP packages into your existing Nx workspace.

## Getting Started

To start using the `@nx-php/phpunit`, follow these steps:

1. Install the plugin as a development dependency in your Nx workspace:

```bash
npm install --save-dev @nx-php/phpunit
```

2. Add a test target for your project.

::: tip 
You likely need to build before you test. This example highlights using [`@nx-php/phpbuild`](https://github.com/graycoreio/nx-php/tree/main/packages/phpbuild-executor).
:::

```json
{
    "name": "my-org/my-package",
    "$schema": "../../node_modules/nx/schemas/project-schema.json",
    "sourceRoot": "packages/my-package/src",
    "projectType": "library",
    "targets": {
        "build": {
            "executor": "@nx-php/phpbuild:phpbuild",
            "dependsOn": [
                "^build"
            ],
        },
        "test": {
            "executor": "@nx-php/phpunit:phpunit",
            "dependsOn": [
                "build"
            ]
        },
    },
    "tags": []
}

```

3. Run your tests! 

::: tip 
If you've done this correctly, you'll see a build (or many builds) before your test runs!
:::

```bash
npx nx run your-project:test
```