3

I am trying to encode my Laravel project but unfortunately, Laravel blade templates are not pure PHP .. so the ioncube encoder/reader is unable to encode it properly.

I have tried these ways mentioned here and here, but my views files are not encoded fully ..or not working the way I want (or I have not understood it properly).

so can anyone please help me and tell me to step by step and clear.

These are some of my files inside the blade.php files which are not encodable.

@php
    // alignment direction according to language
    $dir = "ltr";
    $rtlLang = ['ar'];
    if(in_array(getOption('language'),$rtlLang)):
        $dir="rtl";
    endif;

@endphp


{!! getOption('home_page_meta') !!}
  <title>@yield('title')</title>

  @endif

    {{ csrf_field() }}


    {{ getOption('currency_symbol') . number_format(Auth::user()->funds,2, getOption('currency_separator'), '') }}
Karl Hill
  • 12,937
  • 5
  • 58
  • 95
ppegu
  • 362
  • 2
  • 9
  • 22
  • 2
    Please fact-check me, but as far as I know laravel takes blade files and makes a cache of php files from them. So I guess you could focus there?... or turn off the cache ...? I've used ioncube, but not with laravel. I know them both fairly well and I'd suggest not bothering with the views. Just encode business logic, controllers, services, and so on - and then keep the views really simple and non-proprietary so they don't need to be encoded. Ion cube will run a mix of encoded and non-encoded files. – Tarek Adam Feb 25 '19 at 18:25
  • ^ Your view files shouldn't contain anything worth encoding anyways. Except for a few loops and getters, it's going to be things the client can see in their browser source.. – Devon Bessemer Feb 25 '19 at 18:32
  • yeah i understand what you are saying but i need to protect my views codes as well , cause i have just done building a new designing (theme) of my project's views and i am gonna release this to my users as new theme , but unfortunately previously i released a theme but the users just copy the files from each other , instead of buying from me ... so, that's why i need to protect my codes.. – ppegu Feb 25 '19 at 18:35
  • even it would be great if i can just add this kind of getOption into the view files => {{ getOption('app_name') }} – ppegu Feb 25 '19 at 18:38
  • 2
    How does encoding protect against that? You can't protect against users copying the files. Even if they are encoded, they can still copy them and send them. – Devon Bessemer Feb 25 '19 at 19:56
  • users can copy direct files bro not the source code from browser and i will make server license for the files ... and i need any solution , if you guys can help ... – ppegu Feb 26 '19 at 05:27
  • CSS, JS and HTML is easily examined. Even if protected server side, the code has to be readable by the browser eventually and therefore open. That said, protecting and using ionCube licensing features might help as even though a user could see the theme code in the browser, copying the files that produce it could be made not to work, so they'd have to go through some hoops to use the code that they've harvested from the browser. I recommend contacting ionCube support for guidance and some ideas. Disclosure: I am associated with ionCube – Nick Mar 01 '19 at 16:30

1 Answers1

0

Finally I got an idea and its worked (no one suggested)

you can easily encode your blade by its original code like an example : {{ getOption() }} to <?php echo e(getOption()); ?> . and @if as <php if; ?>

and @section('title', getOption('app_name') . ' - Login') as <?php $__env->startSection('title', getOption('app_name') . ' - login'); ?> and like so. And now you can encoded any blade templates files or laravel projects.

Hope this helpful. Now i have saved my templates file from thief.

Nick
  • 1,334
  • 10
  • 14
ppegu
  • 362
  • 2
  • 9
  • 22