title: PHP Base64 encoding for JSON slash issue
body: <p>I am using <a href="https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/index.html" rel="nofollow noreferrer">Elastic-PHP API 2.0</a> to create an index of Word and PDF documents. This normally requires to send a Base64 encoding of the document as JSON to its <a href="https://github.com/elastic/elasticsearch-mapper-attachments" rel="nofollow noreferrer">Mapper attachment plugin</a>. </p>
  
  <p>However, PHP's Base64 generates slashes <code>\</code> in the encoded string. The JSON which I am trying to construct with this encoding, cannot be parsed by Elastic: </p>
  
  <pre><code>$json = 
      '{"content" : "'.addslashes(chunk_split(base64_encode($file_contents))).'"}'
  </code></pre>
  
  <p>I do not want to remove/replace the slashes, as <a href="https://stackoverflow.com/questions/34182379/php-base64-encode-a-pdf-file">suggested in some Stackoverflow posts</a>, since it may cause problems later with decoding. </p>
  
  <p>How are slashes in Base64 encoding dealt with in such scenarios?   </p>