New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataWriters for persisting items #44

yosymfony opened this Issue Aug 3, 2015 · 0 comments


None yet
1 participant
Copy link

yosymfony commented Aug 3, 2015

The DataWriter's responsibility is to persist the content of the items in filesystem, memory, database or another storage system. Spress comes with FilesystemDataWriter out of the box. A DataWriter must implement DataWriterInterface:

interface DataWriterInterface
     * Prepare the place to store.
     * e.g: clean up the output folder.
    public function setUp();

     * Write a item.
     * @param \Yosymfony\Spress\Core\DataSource\ItemInterface $item
    public function write(ItemInterface $item);

     * Brings down the connections to the data.
    public function tearDown();

Extends Spress with a custom DataWriter

Extends Spress with a DataWriter from a plugin is straightforward:

  • Suscribes to spress.start events and gets the EnvironmentEvent object that received as an argument.
  • Sets a custom DataWriter: $environment->setDataWriter($myDataWriter);

@yosymfony yosymfony changed the title DataWriters for persistent items DataWriters for persisting items Aug 4, 2015

@yosymfony yosymfony added this to the Spress 2.0.0 alpha1 milestone Aug 4, 2015

@yosymfony yosymfony closed this Sep 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment