PHP code example of commacodes / auto-convert-text-to-audio

1. Go to this page and download the library: Download commacodes/auto-convert-text-to-audio library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

commacodes / auto-convert-text-to-audio example snippets


Schema::table('your_model_table', function (Blueprint $table) {
    $table->string('audio_en')->nullable();
    $table->string('audio_fr')->nullable();
    $table->string('audio_ar')->nullable();
});



namespace App\Http\Controllers;

use App\Models\Post;
use Illuminate\Http\Request;
use commacodes\AutoConvertTextToAudio\Traits\HasMultilangTTS;

class PostController extends Controller
{
    use HasMultilangTTS;

    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        $post = new Post();
        $post->name =   $request->name;
        $post->notes    =   ['en' => $request->notes, 'ar' => $request->notes_ar, 'fr' => $request->notes_fr];
        $post->save();
        $post->generateTTS([
            'ar' => $request->notes_ar,
            'en' => $request->notes,
            'fr' =>  $request->notes_fr,
        ]);
        return redirect()->route('post_index');
    }


}

{{asset('upload/tts/'.$your_var->audio_en)}}
{{asset('upload/tts/'.$your_var->audio_ar)}}
{{asset('upload/tts/'.$your_var->audio_fr)}}
bash
php artisan vendor:publish --tag=config