dongshi1215 2016-07-08 12:48
浏览 117

适用于PHP的嵌入式脚本引擎

Not quite sure what to even call what I am trying to do. I am working on a CRM product in PHP which needs to have asynchronous scriptable workflows to be embed-able to that the clients using the software will be able to perform custom tasks on certain triggers, similar to the way workflows operate in Microsoft Dynamics CRM but as a scripted process rather than a visually designed process (would have preferred visual but I imagine that would be exceptionally harder to do as an embeded option.

As an example each time a record status changes the following psuedo code would be run asyncronously...

BEGIN WORKFLOW
    IF status = ARCHIVED THEN
        new email(to, from, subject, body)
        new sms(to, from, message)
   END IF
END WORKFLOW

However I do this I need the ability to be able to add handlers so that the scripting engine can have added functions added to it that work with my code and the entire workflow needs to be encapsulated in a way that it is context aware of the record which initiated the workflow. I am not after software recommendations as that isn't allowed on here as far as I am aware, I am after being pointed in the right direction on how to do this.

I know that I could theoretically just do it all in PHP and let PHP be used as the workflow language but am not wanting to expose all PHP functions or enable the workflows to affect the standard operating of the main application, the scripted workflows would have to be sandboxed and restricted so that not only can they only work with data which has been exposed to them but they can also only use methods which I define for them to use and not have access to the full range of PHP methods or be able to perform actions outside the application control such as including additional files.

I know that I could also simply design a plugin framework that would handle this easily but would rather have it done as a simplified scripting engine, similar in concept to VBA where you can use programming but only to extend the current file within the application and there are restrictions on what can be done.

Any help would be appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码
    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?