labcoding / feedback
ZF2 feedback Module
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/labcoding/feedback
Requires
- php: >=5.5
- t4web/crud: ~1.0.0
- t4web/domain-module: ~1.2.0
- t4web/infrastructure: ~1.2.0
- zendframework/zend-db: ~2.5.0
- zendframework/zend-eventmanager: ~2.5.0
- zendframework/zend-mvc: ~2.5.0
- zendframework/zend-servicemanager: ~2.5.0
Suggests
- t4web/admin: for showing in admin
This package is not auto-updated.
Last update: 2025-10-26 03:14:23 UTC
README
Installation
Add this project in your composer.json:
"require": { "labcoding/feedback": "~0.0.1" }
Now tell composer to download Domain by running the command:
$ php composer.phar update
OR
Run command in console
$ php composer.phar require "labcoding/feedback"
Post installation
Enabling it in your application.config.php file.
<?php return array( 'modules' => array( // ... 'LabCoding\Feedback', ), // ... );
Then you need creating DB table `feedback.'
CREATE TABLE IF NOT EXISTS `feedback` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) DEFAULT null,
`email` VARCHAR(100) DEFAULT null,
`message` TEXT,
`answer` TEXT EFAULT NULL,
`created_dt` DATETIME NOT NULL,
`updated_dt` DATETIME NOT NULL,
`status` TINYINT(1) DEFAULT 1,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
OR run console command:
$ php public/index.php feedback init
And the last, copy to your public folder javascript files: feedback.jfeedbacker.js(they mast located in js/module/feedback feedbackand include partial wear you want to see feedback ffeedbacke>
Events
Feedback events arise when user send feedback ofeedbacksent answer to user.
$eventManager = new EventManager(); $eventManager->getSharedManager()->attach( 'Feedback', FeedbackEvent::EVENT_NEW_FEEDBACK, function(FeedbackEvent $e) { // Feedback entity $entity = $e->getEntity(); // ... }, $priority );
FeedbackEvent::EVENT_NEW_FEEDBACK-new.feedback- arise after a user left feedback ofeedbackte and data save in DB.FeedbackEvent::EVENT_SEND_ANSWER-send.answer- appear after admin click to "Send" button and data updated in DB.
Add new field to feedback (form, table, entity)
1 - Create in your project module Feedback
2 - Add to config new entity map structure:
'entity_map' => [
'Feedback' => [
'entityClass' => \Feedback\Domain\Feedback::class,
'table' => 'feedback',
'primaryKey' => 'id',
'columnsAsAttributesMap' => [
'id' => 'id',
'name' => 'name',
'phone' => 'phone', // it is new field
'email' => 'email',
'message' => 'message',
'answer' => 'answer',
'created_dt' => 'createdDt',
'updated_dt' => 'updatedDt',
'status' => 'status',
],
'criteriaMap' => [
'id' => 'id_equalTo',
]
],
]
3 - Create new Feedback entity file, extends it from \LabCoding\Feedback\Domain\Feedback, and add new property:
<?php class Feedback extends \LabCoding\Feedback\Domain\Feedback { protected $phone; /** * @return mixed */ public function getPhone() { return $this->phone; } }
4 - Crete new input filter, and add it to service manager:
'service_manager' => array( 'invokables' => array( 'LabCoding\Feedback\InputFilter\SendInputFilter' => SendInputFilter::class, ) )
5 - At the last add new field to feedback form