Last active
November 22, 2019 00:18
-
-
Save coulterpeterson/6733ae1926e94a6119d4c45fead4e7b6 to your computer and use it in GitHub Desktop.
#Laravel connect to SMTP using Flysystem #PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Flysystem; | |
use League\Flysystem\Filesystem; | |
use League\Flysystem\Sftp\SftpAdapter; | |
class PagesController extends Controller | |
{ | |
public function connectAndList(){ | |
$host = request('host'); | |
$username = request('username'); | |
$password = request('password'); | |
$filesystem = new Filesystem(new SftpAdapter([ | |
'host' => $host, | |
'port' => 22, | |
'username' => $username, | |
'password' => $password, | |
'timeout' => 10, | |
])); | |
return view('welcome', [ | |
'data' => $filesystem->listContents('/public_html/', false), | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment