Skip to content

Alex Rusin Blog

  • BlogExpand
    • AWS
    • Javascript Development
    • Remix
    • PHP MySQL Development
    • Laravel
    • System Administration
    • WordPress Development
    • Magento
    • Uncategorized
  • My Projects
Alex Rusin Blog
  • Laravel | PHP MySQL Development

    Large CSV Export

    Byalexrusin May 19, 2018May 19, 2018

    Sometimes you need to export a large amount of data from your database.  Obviously, if you are going to accumulate all data in an array and then write it to a csv file, you will eventually run out of memory.  A better solution is to use streams.  Here is how you can export data from…

    Read More Large CSV ExportContinue

  • PHP MySQL Development

    Complex Eloquent Query

    Byalexrusin April 30, 2018April 30, 2018

    A query below selects products that need to be updated in a remote application. It takes quantities of products in host application that are connected to source products application. On top of that it looks at all the orders that are in “Pending” status and reserves quantities for those products. SELECT products.quantity_available, connector_products.stock_id, products.id, connector_products.sku,…

    Read More Complex Eloquent QueryContinue

  • PHP MySQL Development

    Upload to FTP with PHP

    Byalexrusin April 29, 2018April 29, 2018

    $fp = fopen(‘https://www.example.com/pdfdoc’, ‘r’); $user = “sammy”; $pass = “password”; $ftp_server = “192.168.10.10”; //should be wrapped in try catch to properly handle errors $ftp_conn = ftp_ssl_connect($ftp_server); $login = ftp_login($ftp_conn, $user, $pass); ftp_chdir($ftp_conn, ‘path/to/folder’); //can also use ftp_pwd ftp_pasv($ftp_conn, true); //passive mode ftp_fput($ftp_conn, “mydocument.pdf”, $fp, FTP_BINARY); fclose($fp); ftp_close($ftp_conn); Above code can be used to upload a…

    Read More Upload to FTP with PHPContinue

  • System Administration

    Finding Directories And Files And Changing Permissions

    Byalexrusin April 6, 2018

    I always forget how to do this: find /var/www/html -type d -exec chmod 755 {} \; find /var/www/html -type f -exec chmod 644 {} \;  

    Read More Finding Directories And Files And Changing PermissionsContinue

  • System Administration

    Node.js App on AWS EC2 Instance

    Byalexrusin March 31, 2018March 31, 2018

    To get started let’s spin up an Ubuntu 16.4 LTS instance on AWS.  After instance is up and running, we need to add port 80 to the instance’s security group inbound rules.  There should be at least two ports open: 22, and 80. Now we can ssh into the instance and install Nginx, Node, and…

    Read More Node.js App on AWS EC2 InstanceContinue

  • Laravel

    Using Local and Public Disks

    Byalexrusin February 25, 2018February 25, 2018

    Having vagrant run on Windows host machine may cause some problems with symbolic links. After trying to make symbolic links to work and failing, I decided to use public disk in development and local disk in production. php artisan storage:link makes symbolic link from “public/storage” to “storage/app/public”.  When developing on windows-vagrant this command will not work properly,…

    Read More Using Local and Public DisksContinue

  • Laravel | PHP MySQL Development | System Administration

    Laravel Jenkins CI

    Byalexrusin November 26, 2017

    This article covers installation of Jenkins on Ubuntu server and its usage to continuously integrate a Laravel application.  Besides LAMP/LEMP stack we need to install Java, Git, Composer, and Node to successfully use Jenkins. Before starting to install this software, let’s take care of miscellaneous  stuff. Miscellaneous (can skip this). Create mysql user and database….

    Read More Laravel Jenkins CIContinue

  • Laravel

    Laravel: Getting Authenticated User Early in the Controller

    Byalexrusin October 31, 2017April 29, 2020

    Sometimes there is a need to access the authenticated user in your controller.  If you do it in several methods in your controller, it makes sense to put the code in the constructor.  Unfortunately, the code below will not work. This happens because the request is not injected into the controller at the time of…

    Read More Laravel: Getting Authenticated User Early in the ControllerContinue

  • Laravel | PHP MySQL Development

    Composer: Path Repositories

    Byalexrusin October 30, 2017July 15, 2019

    When working on a php package it is inconvenient to push the package to github (or other repository) and then wait for the package to update using composer update.  For package development, composer has such feature as path repositories.  Let’s imagine we have a two folders on the same level:  my-app and  package.   my-app is an app — a test…

    Read More Composer: Path RepositoriesContinue

  • Laravel | System Administration

    Adding Virtual Box Bridged Network Adapter to Laravel Homestead

    Byalexrusin September 16, 2017September 16, 2017

    Vagrant allows you to configure bridged network adapter, so your vagrant(homestead) box can be seen on local network.  I order to make this possible by adding a line of code to homestear.rb script in scripts folder. I opted to add this line after the following code. if settings.has_key?(“networks”) settings[“networks”].each do |network| config.vm.network network[“type”], ip: network[“ip”], bridge: network[“bridge”]…

    Read More Adding Virtual Box Bridged Network Adapter to Laravel HomesteadContinue

Page navigation

Previous PagePrevious 1 … 8 9 10 11 12 13 Next PageNext

© 2025 Alex Rusin Blog - WordPress Theme by Kadence WP

  • Blog
    • AWS
    • Javascript Development
    • Remix
    • PHP MySQL Development
    • Laravel
    • System Administration
    • WordPress Development
    • Magento
    • Uncategorized
  • My Projects