Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ All notable changes are documented here. The format is based on [Keep a Changelo
- Added `list` (aliases `commands`, `enumerate`), listing the available commands. [#1](https://github.com/phalcon/crest/issues/1)
- Added the `bootstrap` key to `crest.php`, naming the project front controller so commands that need a running application can boot one: `'bootstrap' => App\Front\AppFront::class`. Requires a `boot()` returning a container. [#1](https://github.com/phalcon/crest/issues/1)
- Added `Crest\Console\Input::argumentString()`, `optionString()` and `optionStringOrNull()`, narrowing the common string case so commands do not each repeat a type guard.
- Added `make:command`, generating a crest command for a package that contributes its own. Prints the `extra.crest.commands` block to declare it with, since that is the only way the registry finds a command. [#5](https://github.com/phalcon/crest/issues/5)
- Added `make:middleware`, generating an ADR middleware and printing the router middleware-map entry that activates it. [#5](https://github.com/phalcon/crest/issues/5)
- Added `make:provider`, generating a service provider for `Phalcon\Container` and printing the `registerProviders()` override that calls it. [#5](https://github.com/phalcon/crest/issues/5)
- Added `make:responder`, generating an ADR responder that implements the `Responder` contract directly. [#5](https://github.com/phalcon/crest/issues/5)
- Added `stub:publish`, copying packaged stubs into `resources/stubs/<flavor>/` so a project can edit them. The override chain already worked; nothing made it discoverable. [#5](https://github.com/phalcon/crest/issues/5)
- Added `--stub` to `make:action`, rendering any named stub instead of the `--responder` default. Passing both is rejected rather than silently resolved. [#5](https://github.com/phalcon/crest/issues/5)
- Added `command`, `middleware`, `provider` and `responder` to the default `paths` in `crest.php`, alongside `action`. Each is overridable per project as before. [#5](https://github.com/phalcon/crest/issues/5)
- Added `Crest\Command\ProjectCommand`, the base for commands that read the project being run against. Contributed commands can extend it for `--directory` and `--config` handling instead of resolving those options themselves. [#5](https://github.com/phalcon/crest/issues/5)
- Added `Crest\Generator\ClassName::suffixed()`, which appends an artifact suffix idempotently, so `make:middleware Cors` and `make:middleware CorsMiddleware` both produce `CorsMiddleware`. [#5](https://github.com/phalcon/crest/issues/5)

### Changed

Expand All @@ -21,10 +30,20 @@ All notable changes are documented here. The format is based on [Keep a Changelo
- Renamed `Crest\Adr` to `Crest\ADR`, and `Flavor::Adr`, `Flavor::Cli` and `Flavor::Mvc` to `Flavor::ADR`, `Flavor::CLI` and `Flavor::MVC`, matching `Phalcon\ADR`. Backed values are unchanged.
- Renamed `Crest\ADR\CandidateSource` to `ActionResolver` and `PhalconRouterCandidates` to `PhalconRouterResolver`. One path now names exactly one Action, so there are no candidates to choose between.
- Dependencies now resolve against the PHP 8.1 floor via `config.platform`, so the lock matches the declared minimum.
- Default `paths` are now per flavor rather than shared. Only `adr` is populated, so a `cli` or `mvc` project is no longer offered directories for artifacts it has no command to generate. [#5](https://github.com/phalcon/crest/issues/5)
- `crest`, `crest list` and `crest --version` now open with a chevron mark before the name and version. Only the color is dropped from piped output and when `NO_COLOR` is set; the glyph stays. [#5](https://github.com/phalcon/crest/issues/5)

### Fixed

- `make:middleware`, `make:provider` and `make:responder` no longer generate a class that cannot be parsed when the name given is already the suffix. `make:middleware Middleware` produced `final class Middleware implements Middleware` beside `use ...\Middleware;`. The contract is now imported under an alias. [#5](https://github.com/phalcon/crest/issues/5)
- Generators now fail instead of reporting a file they did not write. A target that could not be created produced two PHP warnings, `Created <file>` and exit 0; it now reports `could not create <directory>` and exits 1. [#5](https://github.com/phalcon/crest/issues/5)
- `stub:publish` now rejects a name that is a path. `stub:publish ../../elsewhere/thing` resolved and copied a file from outside the package. [#5](https://github.com/phalcon/crest/issues/5)
- `ClassName::suffixed()` now accepts non-Latin class names, matching PHP's own rule for an identifier. [#5](https://github.com/phalcon/crest/issues/5)

### Removed

- Removed the shadowed-action warning from `make:action`. One path names exactly one Action, so nothing can be shadowed.
- Removed the `phalcon/cli-options-parser` requirement. Crest never linked against it: the schema-aware definition layer stays in `Crest\Console\Parsing`, since `Cop\Parser` is schema-less by design.

[keep_a_changelog]: https://keepachangelog.com/en/1.0.0/
[semantic_versioning]: https://semver.org/spec/v2.0.0.html
Expand Down
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Phalcon Crest

[![Latest Version][packagist-version-badge]][packagist-version-link]
[![PHP Version][php-version-badge]][packagist-version-link]
[![Total Downloads][packagist-downloads-badge]][packagist-downloads-link]
[![License][license-badge]][license-link]

[![Crest CI][crest-ci-badge]][crest-ci-link]
[![Quality Gate Status][sonar-quality-badge]][sonar-link]
[![Coverage][sonar-coverage-badge]][sonar-link]
[![PDS Skeleton][pds-skeleton-badge]][pds-skeleton-link]

[![Discord][discord-badge]][discord-link]
[![Contributors][contributors-badge]][contributors-link]
[![OpenCollective Backers][oc-backers-badge]][oc-backers-link]
[![OpenCollective Sponsors][oc-sponsors-badge]][oc-sponsors-link]

Command line application for Phalcon - generators, introspection and project tooling.

## Requirements
Expand Down Expand Up @@ -53,6 +68,26 @@ return [
];
```

## Booting the project

`container:list` and `event:list` report services and listeners, which exist only once the
application has registered them, so those two start your front controller. Name it in
`crest.php`:

```php
return [
'bootstrap' => App\Front\ApiFront::class,
];
```

The class is constructed with the project root and has to declare `boot()`. There is no
base class and no interface - `boot()` is the whole contract, and what it returns has to
implement `Phalcon\Contracts\Container\Service\Collection`, which
`Phalcon\Container\Container` does. See [docs/index.md](docs/index.md) for the rest.

Every other command - the generators, `about`, `config:show` and `route:list` - reads the
filesystem and keeps working on a project that does not currently run.

## Custom stubs

Copy a stub into `resources/stubs/<flavor>/` in your project and crest uses yours instead
Expand All @@ -72,3 +107,27 @@ of the C extension.
## License

BSD-3-Clause. See [LICENSE](LICENSE).

<!-- Badges -->
[packagist-version-badge]: https://img.shields.io/packagist/v/phalcon/crest?include_prereleases&style=flat-square&logo=packagist&logoColor=white
[packagist-version-link]: https://packagist.org/packages/phalcon/crest
[packagist-downloads-badge]: https://img.shields.io/packagist/dt/phalcon/crest?style=flat-square&logo=packagist&logoColor=white
[packagist-downloads-link]: https://packagist.org/packages/phalcon/crest/stats
[php-version-badge]: https://img.shields.io/packagist/php-v/phalcon/crest?style=flat-square&logo=php&logoColor=white
[license-badge]: https://img.shields.io/github/license/phalcon/crest?style=flat-square&logo=opensourceinitiative&logoColor=white
[license-link]: https://github.com/phalcon/crest/blob/master/LICENSE
[crest-ci-badge]: https://github.com/phalcon/crest/actions/workflows/main.yml/badge.svg?branch=master
[crest-ci-link]: https://github.com/phalcon/crest/actions/workflows/main.yml
[sonar-quality-badge]: https://sonarcloud.io/api/project_badges/measure?project=phalcon_crest&metric=alert_status
[sonar-coverage-badge]: https://sonarcloud.io/api/project_badges/measure?project=phalcon_crest&metric=coverage
[sonar-link]: https://sonarcloud.io/summary/new_code?id=phalcon_crest
[pds-skeleton-badge]: https://img.shields.io/badge/pds-skeleton-blue.svg?style=flat-square
[pds-skeleton-link]: https://github.com/php-pds/skeleton
[discord-badge]: https://img.shields.io/discord/310910488152375297?label=Discord&logo=discord&style=flat-square
[discord-link]: https://phalcon.io/discord
[contributors-badge]: https://img.shields.io/github/contributors/phalcon/crest?style=flat-square&logo=github&logoColor=white
[contributors-link]: https://github.com/phalcon/crest/graphs/contributors
[oc-backers-badge]: https://img.shields.io/opencollective/backers/phalcon?style=flat-square&logo=opencollective&logoColor=white
[oc-backers-link]: https://opencollective.com/phalcon
[oc-sponsors-badge]: https://img.shields.io/opencollective/sponsors/phalcon?style=flat-square&logo=opencollective&logoColor=white
[oc-sponsors-link]: https://opencollective.com/phalcon
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
"license": "BSD-3-Clause",
"keywords": ["phalcon", "cli", "console", "generator", "scaffolding"],
"require": {
"php": "^8.1",
"phalcon/cli-options-parser": "^2.0"
"php": "^8.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
"infection/infection": "^0.29",
"pds/composer-script-names": "^1",
"pds/skeleton": "^1",
"phalcon/phalcon": "v6.0.x-dev",
"phalcon/talon": "^0.8",
"phalcon/talon": "^0.9",
"phpstan/phpstan": "^2",
"phpunit/phpunit": "^10.5",
"squizlabs/php_codesniffer": "^3 || ^4"
Expand Down
Loading