helsingborg-stad / api-sponsor-manager
Manages looking for sponsor listnings.
Package info
github.com/helsingborg-stad/api-sponsor-manager
Type:wordpress-plugin
pkg:composer/helsingborg-stad/api-sponsor-manager
Requires
Requires (Dev)
- brain/monkey: ^2.6
- carthage-software/mago: ^1.6
- mockery/mockery: ^1.6
- php-stubs/acf-pro-stubs: ^6.8
- php-stubs/wordpress-stubs: ^7.1
- phpunit/phpunit: ^11.5
Suggests
- helsingborg-stad/municipio: ^6.0.0
Provides
None
Conflicts
None
Replaces
None
README
API Sponsor Manager
Manages looking for sponsor listnings.
Report Bug
ยท
Request Feature
Table of Contents
- Table of Contents
- About API Sponsor Manager
- Getting Started
- Usage
- Multipart REST upload protocol
- Testing
- Deploy
- Roadmap
- Contributing
- License
- Acknowledgements
About API Sponsor Manager
![API Sponsor Manager Screen Shot][product-screenshot]
Here's a blank template to get started:
Built With
- PHP
- NPM
- Webpack
- Modularity
Getting Started
To get a local copy up and running follow these simple steps.
Prerequisites
This is an example of how to list things you need to use the software and how to install them (mac os).
- composer
brew install composer
- npm
brew install node
Installation
- Clone the repo
git clone https://github.com/helsingborg-stad/api-sponsor-manager.git
- Install and build NPM packages
npm install && npm run build
- Install composer packages
composer install
Usage
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
For more examples, please refer to the Documentation
Multipart REST upload protocol
The receiver accepts native collection POST creates for
/wp/v2/sponsor-assignments and /wp/v2/sponsor-offerings. The image field
must be an ACF image field exposed in the native REST schema. No opt-in
setting is required.
Multipart requests use Content-Type: multipart/form-data and
X-ACF-Rest-Upload: true. Requests without that header pass through untouched
and keep native JSON behavior; other header values also do not opt in. Item
routes and endpoints that do not keep native post creation return 400
acf_rest_upload_unsupported_request.
Send ordinary fields directly with PHP-compatible names such as title,
acf[location][lat], and acf[image]. An uploaded image uses the same
top-level acf[image] destination name as its binary part. Existing attachment
IDs remain ordinary acf[image] values. A file may target only an exposed
top-level ACF image field; an unsupported field returns 400
acf_rest_upload_invalid_reference. A body value and file for the same image
field returns 400 acf_rest_upload_ambiguous_image; malformed file bags return
400 acf_rest_upload_invalid_parts.
Per-file size is limited to min(8 MiB, wp_max_upload_size()); the aggregate
upload is limited to 8 MiB. Exceeding either returns 413
acf_rest_upload_too_large. Field size, width, and height limits also return
400 or 413. An invalid, unreadable, or empty binary part returns 400
acf_rest_upload_invalid_file. A disallowed image type or a field MIME
mismatch returns 415 acf_rest_upload_invalid_file_type.
Authorization failures return 403 acf_rest_upload_forbidden. Storage failures
return a controlled 500 acf_rest_upload_storage_failed. Native authorization,
schema validation, and image limits still apply.
The receiver has no idempotency, replay, durable history, or durable notification delivery. Separate submissions can create duplicate posts, images, and notifications. The receiver cleans up resources owned by an observed failed request. A crash can leave partial data.
The local Database handler keeps ModularityFrontendForm/afterInsertPost. It
sends its normal notification after metadata saving. A multipart completion
notification sends only after the receiver completes the exact request
successfully.
Testing
Run tests only in isolated, non-deployed environments. The lockfile includes Brain Monkey, Mockery, WordPress 7.1, its matching test library, PHPUnit polyfills, and the plugin's ACF import helper.
The pre-merge workflow (.github/workflows/pre-merge-test.yaml) uses PHP 8.3,
installs dependencies from the committed composer.lock, and runs
composer test (the standalone unit suite). The committed dependencies require
PHP 8.2 or newer, so PHP 7.4 cannot install them from the lockfile.
Standalone tests
The unit suite (source/tests/php, phpunit.xml) does not load WordPress.
composer install
composer test
composer lint
Deploy
Instructions for deploys.
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License.
Acknowledgements
Distributed under the MIT License.