GuzzleClientException truncated

By default, a Guzzle error thrown in Laravel will truncate the response body. When you’re deep in an API integration, this is a productivity killer.

Here’s an easy way to error log the full response body from the API.

try {

$response = $client->request( "POST", $this::$resource, [ 'json' => $item ] );

$body = json_decode( $response->getBody()->getContents() );

return $body;
} catch ( \GuzzleHttp\Exception\ClientException $e) {
// here's the good stuff
Log::error($e->getResponse()->getBody()->getContents());
throw $e;

}

Code Workshop is locking in ReactJS.

There’s a common complaint among the javascript ecosystem, from new developers and seasoned developers alike. We’re all exhausted from learning, building with, and then maintaining the new hot framework of the day. Below, we’ve detailed how we decided to lock in ReactJS.

New JS Frameworks.. We're locking in ReactJS.
From https://www.exceptionnotfound.net/wait-pick-learn-ignore-dealing-with-javascript-framework-fatigue/

Who are we?

I’m Rhys Williams. I run Code Workshop, a Sydney app development company. We’re small sized – I run the business by myself from day to day and do the lion’s share of development and client relations. We’ve got tight relationships with a tiny army of Sydney based contractors who look after our UI/UX, WordPress development and QA process.

We take on 2-3 decent sized client projects per year which are either completely written in javascript or some sprinkling on an otherwise laravel back-end application. In the last 5 years, this has been jQuery, AngularJS, VueJS, and most recently ReactJS.

For mobile app development we’ve had similar framework churn to follow the times. Some jQuery, PhoneGap, Ionic, and recently ReactNative.

We’re locking in ReactJS and React Native until 2023.

Now, in 2018, we’re making a call. JS framework churn is over. The toolset has matured and ReactJS won. The toolchain is still evolving (somewhat frustratingly.. Like removing propTypes) but for the next 5 years all of our client side development will be ReactJS/React Native.

We’ve worked on successful ReactJS projects for our eCommerce and traditional business clients in the last 12 months. Supporting the apps is easy, maintaining them is easy, and working on old code is easy.

ReactJS and React Native are well supported and actively developed by huge communities. I suspect it’s a breath of fresh air for developers who’ve followed the same path of us through jQuery, Angular, and a few minor players along the way.

Who uses React Native or ReactJS?

I had a chat with a client last week about who uses React Native, and I was shocked to see just how big the ecosystem has really become.

It’s important to know that some big names use a platform because it means they’re solving huge problems with it successfully. Experimental, toy technologies will often fall to pieces quickly when you use them in anger.

Big apps/projects build using React Native:

Apps using ReactNative

Big websites using ReactJS:

yeah, Netflix uses ReactJS.

This is a much bigger list – ReactJS has been around a few years longer than React Native and has reached something of a saturation point. Here’s a few notable standouts:

  • Yahoo
  • Atlassian
  • KhanAcademy
  • NetFlix
  • New York Times
  • WhatsApp
  • Tesla
  • Visa
  • Spotify
  • Dropbox

Why is it cheaper to build with ReactJS?

Popular frameworks spin out enormously useful and technically amazing resources for developers. React is an open source ecosystem by default, so most of the huge companies listed above also give back to the community.

This typically means large pieces of ReactJS custom code we would otherwise need to write for your app project are written, debugged, QA tested, already in production and open sourced for us to use on your project.

It also means there’s a wealth of technical knowledge and know-how for nearly any problem in the mobile app/web app space. Need a mapping library? Here’s a good one. Images won’t cache properly? Here’s why. There’s a new iOS release? Here’s the permissions updates. The depth of knowledge means problems are solved faster and we’re back to the app build quicker.

React Native is A LOT cheaper.

On the native front, React Native does away with two teams and replaces it with one. It wasn’t so long ago you needed native Android developers and native iOS developers to bring your app to market (unless you used Phonegap, shudder). We develop your app once in React Native. Only building and physical testing is carried out on the two types of devices, which speeds up development time significantly.

React Native also benefits from Expo, a free and open source toolchain to bring your app to market cheaper. Common functionality that is useful for any app development (push notifications, automated build toolchain, filesystem access, social authentication, location awareness, live debugging, sending apps to external parties) is provided out of the box with Expo. Again, this ensures we’re not charging clients to build the same functionality over and over! It’s commoditized code that we don’t need to re-write.

Expo for cross platform native apps

It’d be dishonest to pretend the codebase is 100% out of the box the same between the two platforms with no effort. However, in a recent app build we finished, the code lives in a single repository and differences are handled inline in the code. The future is here, your iOS and Android app can live in one code base. And… it works fine.

The App Store and Google Play both accept React Native apps without a problem, requiring only the typical reviews any app needs.

Talk to us about ReactJS and React Native

We’re locking our business into the React ecosystem for new projects for the next 5 years.

Support and ongoing maintenance are an important part of our business and client relationships, so it’s important to vocally commit and make it clear we’ll be around to support React based projects well into the future.

If you’ve got an app or website project coming up, let us know. We can help you put together a budget, spec out the project, and dive in and build the project when you’re ready. Most importantly, down the track we’ll be around to help with ongoing support, maintenance, and keeping your app or site fresh with the times.

 

 

React Native: Example of full expo app.json

When I first started spending time with React Native, it was often a battle to work out just where and how things were supposed to be formatted in the app.json.

The base file doesn’t include the splash screen, app icon, notification icons, google signin nodes, and nodes required to build for the Play Store and the App Store.

Note the two bundle identifiers should always match (across android and ios). You should increment the 3 version identifiers in a uniform way unless you’re working on separate dedicated teams.

Here’s a lightly modified version of an app.json from a production app we’re working on. I’ll keep adding pieces to this script so it can become a kitchen sink file.

{
  "expo": {
    "sdkVersion": "26.0.0",
    "scheme": "foodorderingapprn",
    "name": "Food Ordering App",
    "version": "0.0.1",
    "orientation": "portrait",
    "slug": "food-ordering-app-rn",
    "icon": "./assets/logo-1024.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "cover",
      "backgroundColor": "#deff00"
    },
    "notification": {
      "icon": "./assets/notification-48.png",
      "color": "#deff00"
    },
    "android": {
      "config": {
        "googleSignIn": {
          "apiKey": "AIzaSyDCXXXXXXXPBTDw9-22222vvYQJiE11111",
          "certificateHash": "FFFFFFFFFFFFAA8BA9C47FF23A4E8FBAC5962675"
        },
        "branch": {
          "apiKey": "key_live_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        }
      },
      "package": "au.com.codeworkshop.food",
      "versionCode": 1,
      "permissions": []
    },
    "ios": {
      "config": {
        "branch": {
          "apiKey": "key_live_hdFKWmm3Yuv7LVjtujrx8knarvj1Yyla"
        }
      },
      "bundleIdentifier": "au.com.codeworkshop.food",
      "buildNumber": "1.0.1"
    },
    "extra": {
      "app_code": "ABCD"
    }
  }
}

Sample Homestead.yaml file for windows

I use Vagrant/Homestead for PHP, WordPress, Laravel development at Code Workshop day in day out with no issues anymore about ‘developing on windows’. xdebug bolts up fine, and there’s far fewer issues when deploying to production because of the matching linux environment.

Here’s a cut down example of my homestead.yaml file that I use and update regularly.

* Notice the mapping of folder to vagrant folder to eventual site.

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: c:/Users/codeworkshop/.ssh/id_rsa.pub

keys:
    - c:/Users/codeworkshop/.ssh/id_rsa

folders:
    - map:  c:/projects/cart-recovery/www.cartrebound.com
      to: /home/vagrant/Code/www.cartrebound.app

sites:
    - map: www.cartrebound.app
      to: /home/vagrant/Code/www.cartrebound.app

databases:
    - codeworkshop