2

We're developing with the Symfony2 framework and selling the application to customers. We don't want that customers have the source code so we want to encrypt it. In Zend Framework we use Ioncube but this isn't working with Symfony2 because Symfony2 reads the PHP files to create a caching file (classes.php).

Is there any solution for encrypting the src directory?

durron597
  • 31,968
  • 17
  • 99
  • 158
Pi Wi
  • 1,076
  • 1
  • 11
  • 20
  • possible duplicate of [Encrypt php code](http://stackoverflow.com/questions/764927/encrypt-php-code) – Oleg Estekhin Jun 04 '14 at 10:18
  • In addition to questions in related category [Best solution to protect PHP code without encryption](http://stackoverflow.com/questions/336057/best-solution-to-protect-php-code-without-encryption?rq=1) can be of interest. How does your question differ from all of this? – Oleg Estekhin Jun 04 '14 at 10:21
  • Oleg, I don't think you can help because you're sending me answers which aren't applicable to my question. This question is about Symfony2 which can't be encrypted with Ioncube or Zend guard. I already tried this and I explained why it isn't working in my question, because it reads the files (not with php!), uses annotations and creates a caching file. – Pi Wi Jun 04 '14 at 10:29
  • Probably I have the answer: http://www.sourceguardian.com/fc-php-frameworks-compatibility-cat-16.html – Pi Wi Jun 04 '14 at 10:48

1 Answers1

3

I got contact with the guys at SourceGuardian. On there website they said they could encrypt Symfony2 projects without modifying the source code. At the end, this wasn't true because annotations couldn't be loaded by the Symfony framework. SourceGuardian came with a solution and they will dive into the problem. For now, it isn't possible to encrypt Symfony2 projects if you use Annotations. You should convert all the annotations to Yaml or XML files. I did this and, after 3 days, it worked like a charm!

So: Don't use annotations in you Symfony2 project if you want to encrypt your source code!

Pi Wi
  • 1,076
  • 1
  • 11
  • 20
  • did you found any opensource solution for the problem? – parisssss Apr 11 '15 at 08:12
  • and another question: you mean not using annotation even in entity generation? or just in controller? – parisssss Apr 11 '15 at 08:13
  • 2
    Hi @parisssss, you can encrypt your files with SourceGuardian or Ioncube (I prefer Ioncube). There is no opensource solution, only commercial ones. About your second question, you can use annotations if you warmup the cache before encrypting it. If you clear the cache afterwards annotations won't work, even in entities (which was our problem). – Pi Wi Apr 13 '15 at 12:04
  • There is an article on the source guardian page (https://www.sourceguardian.com/text-encoding-of-symfony-2-page-166.html), which says that it is possible to use it with symfony, only a few changes are necessary. Has anyone tried this? – olidem Sep 05 '18 at 12:42