fucodo / registry
Installs: 639
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:neos-package
Requires
- neos/flow: ^6 || ^7 || ^8
README
registry
This project adds a small reuseable registry for global options to a flow project
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
About The Project
The project is developer centered, you can use it in any flow project. It created a repository and a service to access the registry.
You may inspect the registry from the commandline.
Built With
- Love
Getting Started
Prerequisites
This is an example of how to list things you need to use the software and how to install them.
- npm
composer req fucodo/registry
Usage
Currently you may directly use the repository, we will add a service.
<?php namespace Vendor\Project\Controller; /* * This file is part of the SBS.LaPo.Helparea package. */ use fucodo\registry\Domain\Repository\RegistryEntryRepository; use Neos\Flow\Annotations as Flow; use Neos\Flow\Mvc\Controller\ActionController; use Vendor\Project\Domain\Model\HelpMessage; class EditorController extends ActionController { /** * @Flow\Inject * @var RegistryEntryRepository */ protected $registry; /** * @return void */ public function indexAction() { $this->view->assign('helpMessage', $this->registry->getValue('Vendor.Project', 'HelpMessage', new HelpMessage())); } }
The given example uses Neos.Flow
Dependency Injection to include the registry repository.
Then the getValue
method is called with the namespace Vendor.Project
and the name Helpmessage
.
As the registry can also store objects, we use serialize internally in doctrine.
To set the value you can use the setValue
method.
$this->registry->set('Vendor.Project', 'HelpMessage', $helpMessage);
The object \Vendor\Project\Domain\Model\HelpMessage
is just a Data Transfer Object in this example,
to combine several properties in a single object.
Internally the registry also provides additional information regarding the registry entry.
createdAt - a DateTimeImmutable representing the creation date of the entry
updatedAt - a DateTimeImmutable representing the last update date of the entry
type - a string representing the datatype in the database
The package also provides some cli commands:
./flow registry:list
./flow registry:set
Please use the ./flow help
command to get the detailed description of the commands.
Roadmap
- Repo and Database access
- CLI inspector
- Abstracted Service
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- 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. See LICENSE.txt
for more information.
Contact
Your Name - @twitter_handle - hello@fucodo.de
Project Link: https://github.com/fucodo/registry
Acknowledgments
TBD.