milesj / decoda

A lightweight lexical string parser for BBCode styled markup.
MIT License
196 stars 52 forks source link

Constants make difficult to extend #18

Closed piratadelfuturo closed 12 years ago

piratadelfuturo commented 12 years ago

I am using Decoda with symfony2.1 which uses composer, and it is very difficult to change the messages, add filters, etc.

It could be good if you could have another aproach for this.

milesj commented 12 years ago

How is it difficult to add filters or hooks? It's pretty straight forward.

As for messages or config in general, just overwrite the files in the config folder.

piratadelfuturo commented 12 years ago

What happens to me is that I am using composer, so if I add a file or modify something in your library composer.phar will not update it, it breaks the update process, I need to override it by inheritance somehow.

Here is the example:


alpha:symfony daniel$ php composer.phar update
Updating dependencies
  - Updating mjohnson/decoda (3.4)

  [RuntimeException]                                                                                         
  Source directory /Users/daniel/Sites/sevenboom/Src/symfony/vendor/mjohnson/decoda has uncommitted changes  

update [--prefer-source] [--dry-run] [--dev] [--no-scripts] [packages1] ... [packagesN]

So it wouldn't be a bad idea if you could add an addPath() method, so far I managed to add custom filters, hooks and messages from external folders by using this symfony2 bundle https://github.com/helios-ag/FMBbCodeBundle as wrapper, i modified it and added certain features so i can pass those external parameters, but the path for the templates is more complicated as it only has one possibility.

milesj commented 12 years ago

I see.

I'm actually working on v4 of this which ports it to PHP 5.3 and utilizes namespaces and allows for more customization. It should solve all these problems.

piratadelfuturo commented 12 years ago

Did you published something laready, or do you know when might be available?

milesj commented 12 years ago

No I only started on it this weekend. I'm hoping to have it available within the next few weeks.

milesj commented 12 years ago

This has been fixed in v4. You can use addPath() to specify custom locations.

https://github.com/milesj/php-decoda/blob/master/Decoda.php#L228