Fix packaging, timezone handling and HTML cleaning bugs
Fix PHP code style issues / php-code-styling (push) Waiting to run
PHPStan / phpstan (push) Waiting to run
run-tests / P8.3 - L11.* - prefer-lowest - ubuntu-latest (push) Waiting to run
run-tests / P8.3 - L11.* - prefer-stable - ubuntu-latest (push) Waiting to run
run-tests / P8.4 - L11.* - prefer-lowest - ubuntu-latest (push) Waiting to run
run-tests / P8.4 - L11.* - prefer-stable - ubuntu-latest (push) Waiting to run
run-tests / P8.3 - L12.* - prefer-lowest - ubuntu-latest (push) Waiting to run
run-tests / P8.3 - L12.* - prefer-stable - ubuntu-latest (push) Waiting to run
run-tests / P8.4 - L12.* - prefer-lowest - ubuntu-latest (push) Waiting to run
run-tests / P8.4 - L12.* - prefer-stable - ubuntu-latest (push) Waiting to run
dependabot-auto-merge / dependabot (pull_request_target) Skipped

- Replace symfony 7.4.x-dev constraints with stable ranges so the
  package installs with minimum-stability stable
- Add the Cision facade referenced in composer.json and a config file
  (slug, timezone); the constructor now falls back to config('cision.slug')
- Convert feed timestamps with a real timezone instead of a hardcoded +2h,
  which was off by an hour during winter time
- Return false from fetchContent() when the request fails or the page
  has no article/heading, instead of throwing
- Fix italic paragraph detection, which never matched
- Fix literal '\n' in HtmlCleaner whitespace cleanup
- Normalize empty feed elements to empty strings
- Update README and add tests for the above
This commit is contained in:
mathiaspalmqvist committed 2026-11-11 20:37:05 +01:00
1 parent f9487a3336
commit 392aec8529
9 files changed
+207 -28

No files matched your search

+22 -3
View File
@@ -24,12 +24,20 @@ A Laravel package for retrieving and parsing data from [Cision News](https://new
composer require mattitjaab/laravel-cision-feed
```
You may optionally set your Cision slug in your `.env`:
Set your Cision newsroom slug in your `.env`:
```
LARAVEL_CISION_FEED_SLUG=your-cision-slug
```
Optionally publish the config file:
```bash
php artisan vendor:publish --tag="laravel-cision-feed-config"
```
Feed timestamps (`created_at`) are converted to `Europe/Stockholm` by default. Override with `LARAVEL_CISION_FEED_TIMEZONE`.
---
## Usage
@@ -37,7 +45,8 @@ LARAVEL_CISION_FEED_SLUG=your-cision-slug
```php
use Mattitja\Cision\Cision;
$cision = new Cision();
$cision = new Cision(); // uses config('cision.slug')
$cision = new Cision('other-company'); // or pass a slug explicitly
// Fetch RSS entries
$items = $cision->press(); // or ->news(), ->financial(), ->media()
@@ -50,6 +59,16 @@ echo $article['published_at']; // ISO timestamp
echo $article['content']; // Clean HTML
```
Or use the facade:
```php
use Mattitja\Cision\Facades\Cision;
$items = Cision::press();
```
All methods return `false` if the request fails or the response cannot be parsed.
---
## Testing
@@ -68,7 +87,7 @@ See [CHANGELOG](CHANGELOG.md) for recent changes.
## Contributing
Contributions are welcome! Please see [CONTRIBUTING](CONTRIBUTING.md) for guidelines.
Contributions are welcome! Please open an issue or pull request.
---