kschroeder / spaced-tracker-symfony
Symfony bundle for the Space-Track client.
Package info
github.com/kschroeder/spaced-tracker-symfony
Type:symfony-bundle
pkg:composer/kschroeder/spaced-tracker-symfony
Requires
- php: ^8.2
- kschroeder/spaced-tracker: ^1.0
- nyholm/psr7: ^1.8
- psr/log: ^3.0
- symfony/config: ^6.4 || ^7.0 || ^8.0
- symfony/dependency-injection: ^6.4 || ^7.0 || ^8.0
- symfony/http-client: ^6.4 || ^7.0 || ^8.0
- symfony/http-kernel: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.5
- squizlabs/php_codesniffer: ^3.11
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Symfony bundle for kschroeder/spaced-tracker, version 1.0.0. MIT license.
This package exists because a Symfony bundle must extend Symfony\Component\HttpKernel\Bundle\Bundle. The Space-Track client itself is framework-agnostic. Other frameworks should depend on kschroeder/spaced-tracker and use SpacedTracker\Integration\Psr11ClientFactory. Mezzio can register SpacedTracker\Integration\Mezzio\ConfigProvider.
symfony/config, symfony/dependency-injection, symfony/http-kernel, and symfony/http-client are constrained to ^6.4 || ^7.0 || ^8.0. nyholm/psr7 is ^1.8. PHP is ^8.2. symfony/http-client is a direct dependency so the bundle can construct a PSR-18 client without an extra binding.
Install
Install kschroeder/spaced-tracker-symfony from Packagist. Composer installs kschroeder/spaced-tracker from Packagist as well:
composer require kschroeder/spaced-tracker-symfony:^1.0
To work on this repository, clone it and run composer update. The repository has no lock file. That command clones kschroeder/spaced-tracker from GitHub, because this checkout's composer.json lists that repository. Replace that entry with a path repository of ../spaced-tracker when Composer should symlink a neighboring checkout instead.
Register the bundle when Flex does not do it for you:
// config/bundles.php return [ SpacedTracker\Symfony\SpacedTrackerBundle::class => ['all' => true], ];
The bundle uses the default extension class SpacedTracker\Symfony\DependencyInjection\SpacedTrackerExtension. Its alias is spaced_tracker.
Configure
Create config/packages/spaced_tracker.yaml:
spaced_tracker: identity: '%env(SPACETRACK_IDENTITY)%' password: '%env(SPACETRACK_PASSWORD)%'
Identity and password are required and cannot be empty. Every other key has the same default as the core EnvironmentConfig. Omit a key to keep the default.
| Environment variable | Config key | Default |
|---|---|---|
SPACETRACK_IDENTITY |
identity |
empty, rejected |
SPACETRACK_PASSWORD |
password |
empty, rejected |
SPACETRACK_BASE_URL |
base_url |
https://www.space-track.org |
SPACETRACK_TIMEOUT |
timeout |
60 |
SPACETRACK_VERIFY_TLS |
verify_tls |
true |
SPACETRACK_RATE_PER_MINUTE |
rate_per_minute |
29 |
SPACETRACK_RATE_PER_HOUR |
rate_per_hour |
299 |
SPACETRACK_LOG_PREDICATE_VALUES |
log_predicate_values |
false |
SPACETRACK_SESSION_TTL |
session_ttl |
7200 |
SPACETRACK_USER_AGENT |
user_agent |
kschroeder-spaced-tracker/1.0 |
SPACETRACK_ENFORCE_ADVISORY |
enforce_advisory_limits |
false |
SPACETRACK_CONCURRENCY |
concurrency |
auto |
concurrency must be auto, sequential, curl, symfony, guzzle, or amp. The core ClientConfig rejects any other value if it gets past the tree. timeout is a float. The rate limits and session_ttl are integers. The three verify_tls, log_predicate_values, and enforce_advisory_limits keys are booleans.
Space-Track asks callers to stay under 30 requests per minute and 300 per hour. The defaults are one below those advisory numbers. Set enforce_advisory_limits: true to make the client refuse queries that would cross the published advisory caps.
Example overrides:
spaced_tracker: identity: '%env(SPACETRACK_IDENTITY)%' password: '%env(SPACETRACK_PASSWORD)%' rate_per_minute: 29 concurrency: sequential verify_tls: true
Put the real values in the environment (.env.local, secrets, or the platform), not in a committed YAML file:
SPACETRACK_IDENTITY=ada@example.com SPACETRACK_PASSWORD=your-space-track-password
Inject the client
The extension registers SpacedTracker\SpaceTrackClientInterface as a public service by calling SpacedTracker\Symfony\ClientFactory::create(). SpacedTracker\SpaceTrackClient is a public alias of that service. Prefer the interface:
use SpacedTracker\Query\Query; use SpacedTracker\SpaceTrackClientInterface; final class SatelliteLookup { public function __construct(private readonly SpaceTrackClientInterface $spaceTrack) { } public function iss(): mixed { return $this->spaceTrack->execute( Query::create('gp')->where('NORAD_CAT_ID', 25544)->limit(1), ); } }
A Psr\Log\LoggerInterface service is passed to the factory when the container has one. The reference uses ContainerInterface::NULL_ON_INVALID_REFERENCE, so a missing logger is null rather than a compile error. Symfony's default logger service implements that interface.
Security
Do not commit the Space-Track password, and do not log it. %env(SPACETRACK_PASSWORD)% keeps the secret out of YAML. The compiled container still receives the resolved password because the client must send it to Space-Track. Protect the container cache and the server environment the same way you protect the application secret.
ClientFactory wraps any logger in SpacedTracker\Log\RedactingLogger before ClientBuilder sees it. ClientBuilder wraps that logger again. The second wrap is harmless. The redactor removes passwords, identities, cookies, and bearer tokens from log messages and context. The core client also redacts request paths when predicate logging is enabled.
Leave log_predicate_values false unless you need predicate text in logs.
Copyright 2026 Kevin Schroeder.